Skip to content

Commit

Permalink
gitignore and setLocalDataPath function
Browse files Browse the repository at this point in the history
  • Loading branch information
dorahermes committed Mar 19, 2024
1 parent fe5bd01 commit f4611ea
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions setLocalDataPath.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
function localDataPath = setLocalDataPath(varargin)
% function LocalDataPath = setLocalDataPath(varargin)
% Return the path to the root CCEP directory and add paths in this repo
%
% input:
% personalDataPath: optional, set to 1 if adding personalDataPath
%
% when adding personalDataPath, the following function should be in the
% root of this repo:
%
% function localDataPath = personalDataPath()
% 'localDataPath = [/my/path/to/data];
%
% function localDataPath = personalDataPath(1)
% % to load path from personalDataPath
%
% personalDataPath is ignored in .gitignore
%
% dhermes, 2020, Multimodal Neuroimaging Lab


if isempty(varargin)
rootPath = which('setLocalDataPath');
ccepRepoPath = fileparts(rootPath);

% add path to functions
addpath(genpath(ccepRepoPath));

% add localDataPath default
localDataPath = fullfile(ccepRepoPath,'data');
elseif ~isempty(varargin)
% add path to data
if varargin{1}==1 && exist('personalDataPath','file')
localDataPath = personalDataPath();

elseif varargin{1}==1 && ~exist('personalDataPath','file')
sprintf(['add personalDataPath function to add your localDataPath:\n'...
'\n'...
'function localDataPath = personalDataPath()\n'...
'localDataPath.input = [/my/path/to/data];\n'...
'localDataPath.output = [/my/path/to/output];\n'...
'\n'...
'this function is ignored in .gitignore'])
return
end

% add path to functions
rootPath = which('setLocalDataPath');
ccepRepoPath = fileparts(rootPath);
addpath(genpath(ccepRepoPath));
end

return

0 comments on commit f4611ea

Please sign in to comment.