forked from JeffersonLab/hcana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.fish
37 lines (28 loc) · 949 Bytes
/
setup.fish
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
#!/usr/bin/fish
function update_path -d "Remove argv[2]argv[3] from argv[1] if argv[2], and prepend argv[4]"
# Assert that we got enough arguments
if test (count $argv) -ne 4
echo "update_path: needs 4 arguments but have " (count $argv)
return 1
end
set var $argv[1]
set newpath $argv[4]
for el in $$var
if test "$argv[2]" = ""; or not test "$el" = "$argv[2]$argv[3]"
set newpath $newpath $el
end
end
set -xg $var $newpath
end
if set -q HCANALYZER
set old_hcanalyzer $HCANALYZER
end
if set -q ANALYZER
set old_analyzer $ANALYZER
end
set -x HCANALYZER (realpath (dirname (status -f)))
set -x ANALYZER $HCANALYZER/podd
update_path LD_LIBRARY_PATH "$old_hcanalyzer" "" $HCANALYZER
update_path LD_LIBRARY_PATH "$old_analyzer" "$HCANALYZER" $ANALYZER
update_path DYLD_LIBRARY_PATH "$old_hcanalyzer" "" $HCANALYZER
update_path DYLD_LIBRARY_PATH "$old_analyzer" "$HCANALYZER" $ANALYZER