--- MITgcm_contrib/gmaze_pv/pv_checkpath.m 2006/06/16 21:12:20 1.1 +++ MITgcm_contrib/gmaze_pv/pv_checkpath.m 2007/09/19 15:37:38 1.6 @@ -1,5 +1,5 @@ % -% [] = PV_CHECKPATH() +% [] = pv_checkpath() % % This function detects where the package gmaze_pv is installed % (the upper level directory where the function volbet2iso @@ -15,13 +15,19 @@ % Determine the directory name where the package is installed: -w = which('volbet2iso'); -packdir = w(1:length(w)-12); +fct_to_find = 'pv_checkpath'; +w = which(fct_to_find); +packdir = w(1:length(w)-(length(fct_to_find)+2)); % Try to found needed subdirectories: -subdir = 'subfct'; -fullsubdir = strcat(packdir,sla,subdir); -if isempty(findstr(path,fullsubdir)) - addpath(fullsubdir) -end + +subdir = struct('name',{'subfct','test','visu','subduc'}); + +for id = 1 : size(subdir(:),1) + subdirname = subdir(id).name; + fullsubdir = strcat(packdir,sla,subdirname); + if isempty(findstr(path,fullsubdir)) + addpath(fullsubdir) + end %if +end %for