binname=mcpath(fname) get full executable path by prepending a command directory path parameters: author: Qianqian Fang, <q.fang at neu.edu> input: fname: input, a file name string output: binname: output, full file name located in the bin directory if global variable ISO2MESH_BIN is set in 'base', it will use [ISO2MESH_BIN filesep cmdname] as the command full path, otherwise, let matlab pass the cmdname to the shell, which will search command in the directories listed in system $PATH variable. -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0001 function binname=mcpath(fname, ext) 0002 % 0003 % binname=mcpath(fname) 0004 % 0005 % get full executable path by prepending a command directory path 0006 % parameters: 0007 % 0008 % author: Qianqian Fang, <q.fang at neu.edu> 0009 % 0010 % input: 0011 % fname: input, a file name string 0012 % 0013 % output: 0014 % binname: output, full file name located in the bin directory 0015 % 0016 % if global variable ISO2MESH_BIN is set in 'base', it will 0017 % use [ISO2MESH_BIN filesep cmdname] as the command full path, 0018 % otherwise, let matlab pass the cmdname to the shell, which 0019 % will search command in the directories listed in system 0020 % $PATH variable. 0021 % 0022 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) 0023 % 0024 0025 p=getvarfrom({'caller','base'},'ISO2MESH_BIN'); 0026 binname=[]; 0027 if(isempty(p)) 0028 % the bin folder under iso2mesh is searched first 0029 tempname=[fileparts(which(mfilename)) filesep 'bin' filesep fname]; 0030 if(exist([fileparts(which(mfilename)) filesep 'bin'])==7) 0031 if(nargin>=2) 0032 if(exist([tempname ext],'file')) 0033 binname=[tempname ext]; 0034 else 0035 binname=fname; % use binary without suffix on system PATH 0036 end 0037 else 0038 binname=tempname; 0039 end 0040 else 0041 binname=fname; 0042 end 0043 else 0044 binname=[p filesep fname]; 0045 end