diff --git a/+colorlab/enter.m b/+colorlab/enter.m index af5f30d..0dbf3ae 100644 --- a/+colorlab/enter.m +++ b/+colorlab/enter.m @@ -22,12 +22,18 @@ function enter(quiet) folder = erase(fileparts(mfilename('fullpath')),'+colorlab'); % > COLORLAB initiates itself - COLORLAB = xgenpath(folder,'**/*.git'); + try + COLORLAB = xgenpath(folder,'**/*.git'); + catch + COLORLAB = genpath(folder); + end oldpath = addpath(COLORLAB); printflag = not(isequal(oldpath,path)); - % Better to check for duplicates - find_duplicate(folder); + % Better to check for duplicates (in MATLAB) + if ~isoctave + find_duplicate(folder); + end % Let the user decide if to save or not to save... if printflag && not(quietflag) @@ -40,4 +46,22 @@ function enter(quiet) fprintf(' \n \n') end +end + +% contains + +function bool = isoctave() +%% ISOCTAVE Determines if you are running under GNU Octave or MATLAB +% +% >> isoctave() +% +% ans = +% +% logical +% +% 0 ----> IF running under MATLAB +% 1 ----> IF running under OCTAVE +% +% See also ispc, ismac, isunix, ver + bool = exist('__octave_config_info__','builtin') == 5; end \ No newline at end of file diff --git a/+colorlab/leave.m b/+colorlab/leave.m index 27f9292..f5eb154 100644 --- a/+colorlab/leave.m +++ b/+colorlab/leave.m @@ -22,9 +22,15 @@ function leave(quiet) folder = erase(fileparts(mfilename('fullpath')),'+colorlab'); % > COLORLAB destroys itself - COLORLAB = xgenpath(folder,'**/*.git'); + try + COLORLAB = xgenpath(folder,'**/*.git'); + catch + COLORLAB = genpath(folder); + end oldpath = rmpath(COLORLAB); - addpath(userpath); % Safety-measure + if ~isoctave + addpath(userpath); % Safety-measure + end printflag = not(isequal(oldpath,path)); % Final greetings! @@ -38,3 +44,21 @@ function leave(quiet) fprintf(' \n \n') end end + +% contains + +function bool = isoctave() +%% ISOCTAVE Determines if you are running under GNU Octave or MATLAB +% +% >> isoctave() +% +% ans = +% +% logical +% +% 0 ----> IF running under MATLAB +% 1 ----> IF running under OCTAVE +% +% See also ispc, ismac, isunix, ver + bool = exist('__octave_config_info__','builtin') == 5; +end \ No newline at end of file diff --git a/+colorlab/vista.m b/+colorlab/vista.m index cfd971b..161bd74 100644 --- a/+colorlab/vista.m +++ b/+colorlab/vista.m @@ -8,10 +8,15 @@ function vista() - folder = erase(fileparts(mfilename('fullpath')),'+colorlab'); - % > COLORLAB introspects itself + folder = erase(fileparts(mfilename('fullpath')),'+colorlab'); + % > COLORLAB introspects itself - xpathshow(folder); + if isoctave + p = genpath(folder); + disp(strsplit(p,pathsep)); + else + xpathshow(folder); % Finer MATLAB option + end % Would the user decide to enter... promote it! fprintf('\n') @@ -20,4 +25,22 @@ function vista() fprintf(' > If you are thrilled: colorlab.enter() ✧ \n') fprintf('\n') +end + +% contains + +function bool = isoctave() +%% ISOCTAVE Determines if you are running under GNU Octave or MATLAB +% +% >> isoctave() +% +% ans = +% +% logical +% +% 0 ----> IF running under MATLAB +% 1 ----> IF running under OCTAVE +% +% See also ispc, ismac, isunix, ver + bool = exist('__octave_config_info__','builtin') == 5; end \ No newline at end of file