From 0717931c6d11bf9305e74fe49f8435692b1b25fc Mon Sep 17 00:00:00 2001 From: Barbara Bertozzi Date: Mon, 17 Nov 2025 15:43:35 +0100 Subject: [PATCH] Update default path for config files --- scripts/sp2xr_generate_config.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/scripts/sp2xr_generate_config.py b/scripts/sp2xr_generate_config.py index 901194f..3c37fcb 100644 --- a/scripts/sp2xr_generate_config.py +++ b/scripts/sp2xr_generate_config.py @@ -170,12 +170,14 @@ def generate_basic_config( # Create output directory if it doesn't exist schema_path = Path(schema_output) - schema_path.parent.mkdir(parents=True, exist_ok=True) + if schema_path.parent != Path("."): + schema_path.parent.mkdir(parents=True, exist_ok=True) + print(f"Created config directory: {schema_path.parent}") with open(schema_output, "w") as f: yaml.dump(config, f, sort_keys=False) - print(f"Data schema config saved to: {schema_output}") + print(f"Data schema config saved to: {schema_path.absolute()}") # Generate separate instrument settings config from INI file if ini_file: @@ -272,12 +274,16 @@ def generate_mapping_config( # Create output directory if it doesn't exist schema_path = Path(schema_output) - schema_path.parent.mkdir(parents=True, exist_ok=True) + if schema_path.parent != Path("."): + schema_path.parent.mkdir(parents=True, exist_ok=True) + print(f"Created config directory: {schema_path.parent}") with open(schema_output, "w") as f: yaml.dump(config, f, sort_keys=False, default_flow_style=False) - print(f"Enhanced data schema config with column mapping saved to: {schema_output}") + print( + f"Enhanced data schema config with column mapping saved to: {schema_path.absolute()}" + ) # Generate separate instrument settings config from INI file if ini_file: @@ -340,8 +346,8 @@ Examples: parser.add_argument( "--schema-output", "-s", - default="config_schema.yaml", - help="Output filename for data schema config (default: config_schema.yaml)", + default="config/config_schema.yaml", + help="Output filename for data schema config (default: config/config_schema.yaml)", ) parser.add_argument( @@ -425,8 +431,8 @@ def main(): # Generate configuration if args.mapping: schema_file = ( - "config_schema_with_mapping.yaml" - if args.schema_output == "config_schema.yaml" + "config/config_schema_with_mapping.yaml" + if args.schema_output == "config/config_schema.yaml" else args.schema_output ) generate_mapping_config(