matlab: detect binary in custom and global search path

This commit is contained in:
Stefan Mahr 2013-09-13 01:37:55 +02:00
parent e81cabe26f
commit b702cebf04
2 changed files with 6 additions and 17 deletions

View File

@ -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

View File

@ -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