Fix env checks
This commit is contained in:
@@ -40,19 +40,19 @@ function varargout = EASYconsole(varargin)
|
||||
fprintf('This script name: %s\n', easyFileName);
|
||||
|
||||
% Set scansDir (project scans directory) intelligently
|
||||
if exist('PROJECT_SCANS_DIR', 'var') && ~isempty(getenv('PROJECT_SCANS_DIR'))
|
||||
if ~isempty(getenv('PROJECT_SCANS_DIR'))
|
||||
scansDir=fullfile(getenv('PROJECT_SCANS_DIR'));
|
||||
if exist(scansDir, 'dir')
|
||||
fprintf('Using scans directory: %s from environment variable PROJECT_SCANS_DIR\n', scansDir);
|
||||
disp('This usually indicates that we are in module mode');
|
||||
if ~exist('PROJECT', 'var') || isempty(getenv('PROJECT'))
|
||||
if isempty(getenv('PROJECT'))
|
||||
dirInfo=fileparts(scansDir);
|
||||
project=dirInfo.name;
|
||||
end
|
||||
else
|
||||
disp('WARNING: PROJECT_SCANS_DIR does not exist');
|
||||
end
|
||||
elseif exist('PROJECT', 'var') && ~isempty(getenv('PROJECT')) % for standalone mode
|
||||
elseif ~isempty(getenv('PROJECT')) % for standalone mode
|
||||
% scansDir=fullfile(parentDir, '..', '..', 'scans', getenv('PROJECT') 'out', 'easy', getenv('PROJECT'));
|
||||
scansDir=fullfile(parentDir, '..', '..', 'scans', getenv('PROJECT'));
|
||||
project=getenv('PROJECT');
|
||||
@@ -97,14 +97,14 @@ function varargout = EASYconsole(varargin)
|
||||
end
|
||||
|
||||
% User sanity check and warning
|
||||
if exist('PROJECT_USER', 'var') && ~isempty(getenv('PROJECT_USER'))
|
||||
if ~isempty(getenv('PROJECT_USER'))
|
||||
if ~equal(getenv('PROJECT_USER'), userName)
|
||||
disp("WARNING: PROJECT_USER does not match the current namespace");
|
||||
end
|
||||
end
|
||||
|
||||
% Allow module to override hardcoded default EASY directory
|
||||
if exist('EASY_DIR','var') && ~isempty(getenv('EASY_DIR'))
|
||||
if ~isempty(getenv('EASY_DIR'))
|
||||
EASY_DIR=fullfile(getenv('EASY_DIR'));
|
||||
if ~strcmp(easyDir, EASY_DIR) % sanity check
|
||||
disp("WARNING: EASY_DIR does not match this script's hardcoded EASY location");
|
||||
@@ -116,7 +116,7 @@ function varargout = EASYconsole(varargin)
|
||||
fprintf('Using EASY script directory: %s from hardcoded default\n', easyDir);
|
||||
end
|
||||
|
||||
if (exist('EASY_RESULTS_DIR', 'var') && ~isempty(getenv('EASY_RESULTS_DIR')))
|
||||
if ~isempty(getenv('EASY_RESULTS_DIR')))
|
||||
easyResultsDir=fullfile(getenv('EASY_RESULTS_DIR'));
|
||||
fprintf('Using output directory: %s from environment variable EASY_RESULTS_DIR\n', easyResultsDir);
|
||||
else
|
||||
@@ -129,7 +129,7 @@ function varargout = EASYconsole(varargin)
|
||||
end
|
||||
end
|
||||
|
||||
if exist('MASTER_PLATE_FILE', 'var') && ~isempty(getenv('MASTER_PLATE_FILE'))
|
||||
if ~isempty(getenv('MASTER_PLATE_FILE'))
|
||||
masterPlateFile=fullfile(getenv('MASTER_PLATE_FILE'));
|
||||
fprintf('Using drug media file: %s from environment variable MASTER_PLATE_FILE\n', masterPlateFile);
|
||||
else
|
||||
@@ -143,7 +143,7 @@ function varargout = EASYconsole(varargin)
|
||||
end
|
||||
end
|
||||
|
||||
if exist('DRUG_MEDIA_FILE', 'var') && ~isempty(getenv('DRUG_MEDIA_FILE'))
|
||||
if ~isempty(getenv('DRUG_MEDIA_FILE'))
|
||||
drugMediaFile=fullfile(getenv('DRUG_MEDIA_FILE'));
|
||||
fprintf('Using drug media file: %s from environment variable DRUG_MEDIA_FILE\n', drugMediaFile);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user