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
|
# File 'lib/visual_studio/environment.rb', line 5
def self.merge(base, overlay)
cased = (overlay.keys + base.keys).uniq.map{|key| [key.upcase, key]}.to_h
env = canonicalize(base).merge(canonicalize(overlay)) do |variable, base, overlay|
if SEARCH_DIRECTORIES.include? variable.upcase
base = base.split(';')
overlay = overlay.split(';')
should_include_cwd = base.include?('.') || overlay.include?('.')
base = base.reject{|p| p=='.'}.map{|p| File.expand_path(p)}
overlay = overlay.reject{|p| p=='.'}.map{|p| File.expand_path(p)}
path = base | overlay
path = ['.'] + path if should_include_cwd
path.join(';')
else
overlay
end
end
env.map { |canonical, value|
[cased[canonical], value]
}.to_h
end
|