From f33473fcf07029fa8ad7cce484d2e00a4ee4fb84 Mon Sep 17 00:00:00 2001 From: Jan Lemmer <jan.lemmer@fst.tu-darmstadt.de> Date: Tue, 22 Feb 2022 16:17:16 +0100 Subject: [PATCH] Change search path for config files config files in the plotID folder will be prefered --- +PlotID/@config/config.m | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/+PlotID/@config/config.m b/+PlotID/@config/config.m index 801698d..cfece4d 100644 --- a/+PlotID/@config/config.m +++ b/+PlotID/@config/config.m @@ -21,15 +21,23 @@ classdef config < handle % reads config data from config file, if an error occurs the % wizard is started by the catch block obj.configFileName = configFileName; - try - txt = fileread(obj.configFileName); + try %Validity Check + tmp = what("PlotID"); + tmp = strrep(tmp.path,'+PlotID',''); + defaultConfigPath = fullfile(tmp,obj.configFileName); + if isfile(defaultConfigPath) + txt = fileread(defaultConfigPath); + else %search on path + txt = fileread(obj.configFileName); + end + obj.configData = jsondecode(txt); assert(checkConfig(obj)); if isfield(obj.configData,'ExportPath') obj.exportPath = obj.configData.ExportPath; obj.configData.options.Location = 'exportPath'; end - catch + catch msg = ['no valid config File with the filename ',... obj.configFileName, ' found.' newline,... 'Please enter the required information manually']; -- GitLab