diff --git a/matlab/CalcNF2FF.m b/matlab/CalcNF2FF.m index b51abcb..cb4cc66 100644 --- a/matlab/CalcNF2FF.m +++ b/matlab/CalcNF2FF.m @@ -87,14 +87,9 @@ m_filename = mfilename('fullpath'); dir_name = fileparts( m_filename ); if isunix - % try development path - nf2ff_bin = [dir_name filesep '..' filesep 'nf2ff' filesep 'nf2ff']; - if (~exist(nf2ff_bin,'file')) - % fallback to install path - nf2ff_bin = [dir_name filesep '..' filesep '..' filesep '..' filesep 'bin' filesep 'nf2ff']; - end + nf2ff_bin = searchBinary('nf2ff',[dir_name filesep '..' filesep 'nf2ff' filesep]); else - nf2ff_bin = [dir_name filesep '..' filesep 'nf2ff.exe']; + nf2ff_bin = searchBinary('nf2ff.exe',[dir_name filesep '..' filesep]); end if ((exist(nf2ff.hdf5,'file') && (mode==0)) || (mode==2)) @@ -112,7 +107,7 @@ savePath = pwd; cd(Sim_Path); try - if (~exist(nf2ff_bin,'file')) + if (isempty(nf2ff_bin)) error('openEMS:CalcNF2FF','nf2ff binary not found!'); end if isunix diff --git a/matlab/private/invoke_openEMS.m b/matlab/private/invoke_openEMS.m index abfa3f1..5754e0e 100644 --- a/matlab/private/invoke_openEMS.m +++ b/matlab/private/invoke_openEMS.m @@ -27,18 +27,12 @@ filename = mfilename('fullpath'); dir = fileparts( filename ); if isunix - % try development path - openEMS_bin = [dir filesep '..' filesep '..' filesep 'openEMS.sh']; - if (~exist(openEMS_bin,'file')) - % fallback to install path - openEMS_bin = [dir filesep '..' filesep '..' filesep '..' filesep '..' filesep 'bin' filesep 'openEMS.sh']; - end + openEMS_bin = searchBinary('openEMS.sh',[dir filesep '..' filesep '..' filesep]); else % assume windows - openEMS_bin = [dir filesep '..' filesep '..' filesep]; - openEMS_bin = [openEMS_bin 'openEMS.exe']; + openEMS_bin = searchBinary('openEMS.exe',[dir filesep '..' filesep '..' filesep]); end -if (~exist(openEMS_bin,'file')) +if (isempty(openEMS_bin)) error('openEMS:invoke_openEMS', 'openEMS binary not found!'); end