Skip to content
Snippets Groups Projects
Commit f90a4051 authored by Antoine Merle's avatar Antoine Merle
Browse files

Drop persistent variable and check if gdat_MACHINE is not already in the path.

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@9687 d63d8f72-b253-0410-a779-e742ad2e26cf
parent 066f940a
No related branches found
No related tags found
No related merge requests found
......@@ -118,15 +118,12 @@ end
% Avoid running addpath over and over, this can take some time when there
% are many folders in the path
persistent last_machine
if isempty(last_machine) || ~strcmpi(last_machine,machine_eff)
% add paths to each machine which are in subdirectory of gdat and working
% add only given machine directory using machine_eff...
gdat_path = mfilename('fullpath');
addpath([gdat_path(1:end-4) upper(machine_eff)]);
last_machine = machine_eff;
subfunction = sprintf('gdat_%s',deblank(lower(machine_eff)));
if isempty(which(subfunction)),
gdat_path = fileparts(mfilename('fullpath'));
addpath(fullfile(gdat_path,upper(machine_eff)));
end
% NOTE: we could also check if it matches the path to the main function.
% copy gdat present call:
gdat_call = [];
......
function gdatpaths
%
% add paths for gdat directory
%
% assumes gdat already available
%
a=which('gdat');
ii=findstr('/',a);
a=a(1:ii(end));
if isempty(a), error('gdat is not in the MATLAB path'); end
a = fileparts(a);
machines=[{'JET'} {'TCV'} {'AUG'} {'D3D'}];
machines=[{'JET'} {'TCV'} {'AUG'} {'KSTAR'}];
......@@ -13,7 +14,6 @@ machines=[{'JET'} {'TCV'} {'AUG'} {'D3D'} {'KSTAR'}];
add_paths = cell(1,length(machines));
for i=1:length(machines)
add_paths{i}=[a machines{i}];
add_paths{i}=fullfile(a,machines{i});
end
addpath(add_paths{:});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment