| 1 |
gmaze |
1.1 |
% |
| 2 |
gmaze |
1.3 |
% [] = pv_checkpath() |
| 3 |
gmaze |
1.1 |
% |
| 4 |
|
|
% This function detects where the package gmaze_pv is installed |
| 5 |
|
|
% (the upper level directory where the function volbet2iso |
| 6 |
|
|
% is found) and ensure that sub-directories are in the path |
| 7 |
|
|
% |
| 8 |
|
|
|
| 9 |
|
|
function [] = pv_checkpath() |
| 10 |
|
|
|
| 11 |
|
|
% Windows/Linux compatibility |
| 12 |
|
|
global sla |
| 13 |
|
|
sla = '/'; |
| 14 |
|
|
if ispc , sla = '\'; end |
| 15 |
|
|
|
| 16 |
|
|
|
| 17 |
|
|
% Determine the directory name where the package is installed: |
| 18 |
gmaze |
1.4 |
fct_to_find = 'pv_checkpath'; |
| 19 |
|
|
w = which(fct_to_find); |
| 20 |
|
|
packdir = w(1:length(w)-(length(fct_to_find)+2)); |
| 21 |
gmaze |
1.1 |
|
| 22 |
|
|
|
| 23 |
|
|
% Try to found needed subdirectories: |
| 24 |
gmaze |
1.2 |
|
| 25 |
gmaze |
1.4 |
subdir = struct('name',{'subfct','test','visu','subduc'}); |
| 26 |
gmaze |
1.2 |
|
| 27 |
|
|
for id = 1 : size(subdir(:),1) |
| 28 |
|
|
subdirname = subdir(id).name; |
| 29 |
|
|
fullsubdir = strcat(packdir,sla,subdirname); |
| 30 |
|
|
if isempty(findstr(path,fullsubdir)) |
| 31 |
|
|
addpath(fullsubdir) |
| 32 |
|
|
end %if |
| 33 |
|
|
end %for |