diff --git a/+PlotID/@config/config.m b/+PlotID/@config/config.m index 801698da6282a94fe1a731c32c7fca7309741470..cfece4d21ea2fd558a7f2cc4ff37787667ded57b 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'];