File: fallbackexeext.m

package info (click to toggle)
octave-iso2mesh 1.9.8%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 11,128 kB
  • sloc: cpp: 11,982; ansic: 10,158; sh: 365; makefile: 59
file content (43 lines) | stat: -rw-r--r-- 1,441 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function exesuff = fallbackexeext(exesuffix, exename)
%
% exesuff=fallbackexeext(exesuffix, exename)
%
% get the fallback external tool extension names for the current platform
%
% author: Qianqian Fang, <q.fang at neu.edu>
%
% input:
%     exesuffix: the output executable suffix from getexeext
%     exename: the executable name
%
% output:
%     exesuff: file extension for iso2mesh tool binaries
%
% -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
%

exesuff = exesuffix;
if (strcmp(exesuff, '.mexa64') && exist([mcpath(exename) exesuff], 'file') == 0) % fall back to i386 linux
    exesuff = '.mexglx';
end
if (strcmp(exesuff, '.mexmaci64') && exist([mcpath(exename) exesuff], 'file') == 0) % fall back to i386 mac
    exesuff = '.mexmaci';
end
if (strcmp(exesuff, '.mexmaci') && exist([mcpath(exename) exesuff], 'file') == 0) % fall back to ppc mac
    exesuff = '.mexmac';
end
if (exist([mcpath(exename) exesuff], 'file') == 0) % fall back to OS native package
    exesuff = '';
end

if (exist([mcpath(exename) exesuff], 'file') == 0)
    if (system(['which ' exename]) == 0)
        return
    end
    error(['The following executable:\n' ...
           '\t%s%s\n' ...
           'is missing. Please download it from ' ...
           'https://github.com/fangq/iso2mesh/tree/master/bin/ ' ...
           'and save it to the above path, then rerun the script.\n' ...
          ], mcpath(exename), getexeext);
end