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 ); dir_name = fileparts( m_filename );
if isunix if isunix
% try development path nf2ff_bin = searchBinary('nf2ff',[dir_name filesep '..' filesep 'nf2ff' filesep]);
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
else else
nf2ff_bin = [dir_name filesep '..' filesep 'nf2ff.exe']; nf2ff_bin = searchBinary('nf2ff.exe',[dir_name filesep '..' filesep]);
end end
if ((exist(nf2ff.hdf5,'file') && (mode==0)) || (mode==2)) if ((exist(nf2ff.hdf5,'file') && (mode==0)) || (mode==2))
@ -112,7 +107,7 @@ savePath = pwd;
cd(Sim_Path); cd(Sim_Path);
try try
if (~exist(nf2ff_bin,'file')) if (isempty(nf2ff_bin))
error('openEMS:CalcNF2FF','nf2ff binary not found!'); error('openEMS:CalcNF2FF','nf2ff binary not found!');
end end
if isunix if isunix

View File

@ -27,18 +27,12 @@ filename = mfilename('fullpath');
dir = fileparts( filename ); dir = fileparts( filename );
if isunix if isunix
% try development path openEMS_bin = searchBinary('openEMS.sh',[dir filesep '..' filesep '..' filesep]);
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
else % assume windows else % assume windows
openEMS_bin = [dir filesep '..' filesep '..' filesep]; openEMS_bin = searchBinary('openEMS.exe',[dir filesep '..' filesep '..' filesep]);
openEMS_bin = [openEMS_bin 'openEMS.exe'];
end end
if (~exist(openEMS_bin,'file')) if (isempty(openEMS_bin))
error('openEMS:invoke_openEMS', 'openEMS binary not found!'); error('openEMS:invoke_openEMS', 'openEMS binary not found!');
end end