-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.m
48 lines (45 loc) · 1.46 KB
/
init.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
envs = [["GEMINI_ROOT" ...
, "GEMINI_MAT_ROOT" ...
, "GEMINI_SCR_ROOT" ...
, "GEMINI_SIM_ROOT" ...
, "AUROGEM_ROOT"] ...
;["contents of https://github.com/gemini3d/gemini3d" ...
, "contents of https://github.com/gemini3d/mat_gemini" ...
, "contents of https://github.com/gemini3d/mat_gemini-scripts" ...
, "simulation directory"...
, "contents of https://github.com/317Lab/aurora_gemini" ...
]];
if not(exist(fullfile('data', 'init'), 'dir'))
mkdir(fullfile('data', 'init'))
end
for env = envs
filename = fullfile('data', 'init', env(1));
if not(isempty(getenv(env(1))))
warning('Overwriting environment variable %s with contents of %s', ...
env(1), filename)
end
fid = fopen(filename, 'r');
if fid ~= -1
env_path = fgetl(fid);
else
fclose all;
while true
env_path = input(sprintf('Please enter root path to the %s:\n %s = ' ...
, env(2), env(1)), 's');
env_path = [filesep, fullfile(env_path)];
if isfolder(env_path)
break
else
warning('%s is not a directory', env_path)
end
end
fid = fopen(filename, 'w');
fprintf(fid, '%s', env_path);
fclose(fid);
end
fprintf(' %s = %s\n', env(1), env_path)
setenv(env(1), env_path)
addpath(fullfile(env_path))
end
fclose all;
clear('envs', 'env', 'env_path', 'filename', 'fid', 'ans');