Skip to content

Commit 407c88a

Browse files
committed
UNST-9678: update qp_basedir('exe') in deployed mode on Windows: d3d_qp.exe is not always located in the first folder on the PATH.
1 parent e163de1 commit 407c88a

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

src/tools_lgpl/matlab/quickplot/progsrc/md_colormap.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
S = convertcolors(S,newspace);
307307
case 'save'
308308
try
309-
qp_path=qp_basedir;
309+
qp_path=qp_basedir('exe');
310310
clrmap_path=[qp_path filesep 'colormaps'];
311311
catch
312312
clrmap_path=pwd;
@@ -386,7 +386,7 @@
386386
switch cmd
387387
case 'load'
388388
try
389-
qp_path=qp_basedir;
389+
qp_path=qp_basedir('exe');
390390
clrmap_path=[qp_path filesep 'colormaps'];
391391
catch
392392
clrmap_path=pwd;

src/tools_lgpl/matlab/quickplot/progsrc/private/qp_basedir.m

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
%
44
% PATH=QP_BASEDIR(TYPE)
55
% where TYPE=
6-
% 'base' returns base directory of installation (default).
7-
% 'exe' returns directory of executable.
8-
% 'pref' returns preference directory of installation.
6+
% 'deploy' returns directory of executable.
7+
% 'exe' returns directory of executable (default).
8+
% 'pref' returns preference directory of installation.
9+
10+
% 'base' returns base directory of installation if
11+
% matlabversionnumber < 7 (obsolete).
912

1013
%----- LGPL --------------------------------------------------------------------
1114
%
@@ -38,7 +41,7 @@
3841
% $Id$
3942

4043
if nargin==0
41-
t='base';
44+
t='exe';
4245
elseif ~ischar(t)
4346
error('Invalid input argument.');
4447
end
@@ -93,12 +96,23 @@
9396
function folder = exeroot
9497
c = computer;
9598
if strcmp(c(1:2),'PC')
96-
[status, result] = system('set PATH');
99+
[~, result] = system('set PATH');
100+
linefeed = strfind(result,newline);
97101
eql = strfind(result,'=');
98-
col = strfind(result,';');
99-
folder = strtrim(result(eql(1)+1:col(1)-1));
100-
filename = check_path([folder filesep 'd3d_qp.version']);
101-
folder = fileparts(filename);
102+
result = result(eql(1)+1:linefeed(1)-1);
103+
folders = strsplit(result,';');
104+
folder = '';
105+
for i = 1:length(folders)
106+
try % typically d3d_qp.exe is located in the first folder, but sometimes in the second one ...
107+
filename = check_path([folder filesep 'd3d_qp.exe']);
108+
folder = fileparts(filename);
109+
return
110+
catch
111+
end
112+
end
113+
if isempty(folder)
114+
error('Unable to locate the QUICKPLOT executable.')
115+
end
102116
else % Unix
103117
% call a mex file
104118
folder = fileparts(exepath);
@@ -142,10 +156,10 @@ function ensure_directory(dirname)
142156
ensure_directory(parent);
143157
cd(parent)
144158
c = computer;
145-
if c(1:2) == 'PC'
146-
s=dos(['mkdir "',thisdir,'"']);
159+
if strcmp(c(1:2),'PC')
160+
status = dos(['mkdir "',thisdir,'"']); %#ok<NASGU>
147161
else
148-
s=unix(['mkdir -p ',thisdir]);
162+
status = unix(['mkdir -p ',thisdir]); %#ok<NASGU>
149163
end
150164
end
151165

src/tools_lgpl/matlab/quickplot/progsrc/private/qp_colormap.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
%
7171
% Retreive directory information from QP_BASEDIR.
7272
%
73-
qp_path = qp_basedir('base');
73+
qp_path = qp_basedir('exe');
7474
clrmap_path = [qp_path filesep 'colormaps'];
7575
%
7676
% Reset list of loaded colormaps.

0 commit comments

Comments
 (0)