diff --git a/schemer_import.m b/schemer_import.m index 9749ee6..83264e2 100644 --- a/schemer_import.m +++ b/schemer_import.m @@ -155,7 +155,7 @@ else % Dialog asking for input filename % Need to make this dialogue include .txt by default, at least - [filename, pathname] = uigetfile(filefilt); + [filename, pathname] = uigetfile(filefilt,[],getSchemeDialogPathSafely()); % End if user cancels if isequal(filename, 0); if nargout>0; varargout{1} = 0; end; @@ -710,3 +710,17 @@ end end + +function defaultSchemePath = getSchemeDialogPathSafely() +% getSchemeDialogPathSafely() - Get the scheme path for the uigetfile. +% If the folder doesn't exist in the expected relative path, +% this will return the path to the folder containing the current mfile +% to prevent a warning. +expectedRelativePath = '/schemes/'; +[thisFilePath, ~, ~] = fileparts(mfilename('fullpath')); +defaultSchemePath= fullfile(thisFilePath,expectedRelativePath); +% Safe fallback if schemes folder isn't in expected relative path. +if not( exist(defaultSchemePath,'dir') ) + defaultSchemePath = thisFilePath; +end +end