29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/chef/mixin/path_sanity.rb', line 29
def sanitized_path(env = ENV)
env_path = env["PATH"].nil? ? "" : env["PATH"].dup
path_separator = Chef::Platform.windows? ? ";" : ":"
new_paths = env_path.split(path_separator)
[ ruby_bindir, gem_bindir ].compact.each do |path|
new_paths = [ path ] + new_paths unless new_paths.include?(path)
end
sane_paths.each do |path|
new_paths << path unless new_paths.include?(path)
end
new_paths.join(path_separator).encode("utf-8", invalid: :replace, undef: :replace)
end
|