Changeset 19105 for issm/trunk/externalpackages/export_fig/ghostscript.m
- Timestamp:
- 02/12/15 16:48:40 (10 years ago)
- Location:
- issm/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:ignore
-
old new 1 build-fw 2 build-ad 1 3 nightlylog 2 4 configure.sh
-
- Property svn:mergeinfo changed
/issm/trunk-jpl merged: 18302-18306,18308-18311,18313-18322,18326-18337,18339-18351,18353-18355,18357-18513,18515-19101
- Property svn:ignore
-
issm/trunk/externalpackages/export_fig/ghostscript.m
r14310 r19105 20 20 % result - Output from ghostscript. 21 21 22 % Copyright: Oliver Woodford, 2009-201 022 % Copyright: Oliver Woodford, 2009-2013 23 23 24 24 % Thanks to Jonas Dorn for the fix for the title of the uigetdir window on … … 32 32 % 12/12/12 - Add extra executable name on Windows. Thanks to Ratish 33 33 % Punnoose for highlighting the issue. 34 % 28/6/13 - Fix error using GS 9.07 in Linux. Many thanks to Jannick 35 % Steinbring for proposing the fix. 36 % 24/10/13 - Fix error using GS 9.07 in Linux. Many thanks to Johannes 37 % for the fix. 38 % 23/01/2014 - Add full path to ghostscript.txt in warning. Thanks to Koen 39 % Vermeer for raising the issue. 34 40 35 41 function varargout = ghostscript(cmd) 42 % Initialize any required system calls before calling ghostscript 43 shell_cmd = ''; 44 if isunix 45 shell_cmd = 'export LD_LIBRARY_PATH=""; '; % Avoids an error on Linux with GS 9.07 46 end 47 if ismac 48 shell_cmd = 'export DYLD_LIBRARY_PATH=""; '; % Avoids an error on Mac with GS 9.07 49 end 36 50 % Call ghostscript 37 [varargout{1:nargout}] = system(sprintf(' "%s" %s', gs_path, cmd));38 return 51 [varargout{1:nargout}] = system(sprintf('%s"%s" %s', shell_cmd, gs_path, cmd)); 52 end 39 53 40 54 function path_ = gs_path … … 85 99 end 86 100 else 87 bin= {'/usr/bin/gs', '/usr/local/bin/gs'};88 for a = 1:numel( bin)89 path_ = bin{a};101 executable = {'/usr/bin/gs', '/usr/local/bin/gs'}; 102 for a = 1:numel(executable) 103 path_ = executable{a}; 90 104 if check_store_gs_path(path_) 91 105 return … … 119 133 end 120 134 error('Ghostscript not found. Have you installed it from www.ghostscript.com?'); 135 end 121 136 122 137 function good = check_store_gs_path(path_) … … 128 143 % Update the current default path to the path found 129 144 if ~user_string('ghostscript', path_) 130 warning('Path to ghostscript installation could not be saved. Enter it manually in ghostscript.txt.');145 warning('Path to ghostscript installation could not be saved. Enter it manually in %s.', fullfile(fileparts(which('user_string.m')), '.ignore', 'ghostscript.txt')); 131 146 return 132 147 end 133 return 148 end 134 149 135 150 function good = check_gs_path(path_) 136 151 % Check the path is valid 137 [good, message] = system(sprintf('"%s" -h', path_)); 152 shell_cmd = ''; 153 if ismac 154 shell_cmd = 'export DYLD_LIBRARY_PATH=""; '; % Avoids an error on Mac with GS 9.07 155 end 156 [good, message] = system(sprintf('%s"%s" -h', shell_cmd, path_)); 138 157 good = good == 0; 139 return 158 end
Note:
See TracChangeset
for help on using the changeset viewer.