Skip to content
Snippets Groups Projects
Commit 93bc12cd authored by Joseph Ramsay's avatar Joseph Ramsay
Browse files

Re #22526 Improve search for template file

Made the check slightly more readable, and also more robust about
there being multiple script directories with the word Diffraction in
parent 8b17d616
No related branches found
No related tags found
No related merge requests found
......@@ -125,18 +125,20 @@ class SaveGEMMAUDParamFile(PythonAlgorithm):
return (bank_param_list[grouping_scheme[spec_num] - 1] for spec_num in spectrum_numbers)
def _find_isis_powder_dir(self):
script_dirs = config["pythonscripts.directories"].split(";")
diffraction_dir = None
for dir in script_dirs:
if "Diffraction" in dir:
diffraction_dir = dir
if diffraction_dir is None:
logger.warning("Could not find default diffraction directory for .maud template file: "
"you'll have to find it yourself")
return ""
else:
return os.path.join(diffraction_dir, "isis_powder", "gem_routines", "maud_param_template.maud")
script_dirs = [directory for directory in config["pythonscripts.directories"].split(";")
if "Diffraction" in directory]
for directory in script_dirs:
path_to_test = os.path.join(directory,
"isis_powder",
"gem_routines",
"maud_param_template.maud")
if os.path.exists(path_to_test):
return path_to_test
logger.warning("Could not find default diffraction directory for .maud template file: "
"you'll have to find it yourself")
return ""
def _format_param_list(self, param_list):
return "\n".join(str(param) for param in param_list)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment