20 shell_cmd =
" export LD_LIBRARY_PATH=''; ";
24 [
varargout[1:nargout]] = system(sprintf(
" %s'%s' %s ", shell_cmd, gs_path, cmd));
41 if check_gs_path(path_)
46 bin = [
" gswin32c.exe ",
" gswin64c.exe ",
" gs "];
52 if check_store_gs_path(path_)
58 default_location =
" C:\Program Files\gs\ ";
59 dir_list = dir(default_location);
61 default_location =
" C:\Program Files (x86)\gs\ ";
63 dir_list = dir(default_location);
65 executable = [
" \bin\gswin32c.exe ",
" \bin\gswin64c.exe "];
68 for a = 1:numel(dir_list)
69 ver_num2 = sscanf(dir_list(a).name,
" gs%g ");
70 if ~isempty(ver_num2) && ver_num2 > ver_num
71 for b = 1:numel(executable)
72 path2 = [default_location dir_list(a).name executable[b]];
73 if exist(path2,
" file ") == 2
80 if check_store_gs_path(path_)
84 bin = [
" /usr/bin/gs ",
" /usr/local/bin/gs "];
87 if check_store_gs_path(path_)
94 if strncmp(computer,
" MAC ", 3)
98 uiwait(warndlg(
" Ghostscript not found. Please locate the program. "))
100 base = uigetdir(
" / ",
" Ghostcript not found. Please locate the program. ");
105 base = [base filesep];
106 bin_dir = [, [
" bin " filesep], [
" lib " filesep]];
107 for a = 1:numel(bin_dir)
109 path_ = [base bin_dir[a] bin[b]];
110 if exist(path_,
" file ") == 2
111 if check_store_gs_path(path_)
118 error(
" Ghostscript not found. Have you installed it from www.ghostscript.com? ");
123 good = check_gs_path(path_);
129 warning(
" Path to ghostscript installation could not be saved. Enter it manually in ghostscript.txt. ");
137 [good, message] = system(sprintf(
" '%s' -h ", path_));
function string = user_string(string_name, string)
function good = ghostscript>check_gs_path(path_)
function varargout = ghostscript(cmd)
Initialize any required system calls before calling ghostscript.
function good = ghostscript>check_store_gs_path(path_)
function path_ = ghostscript>gs_path()
A variable number of output arguments.