Revision 308be2fc
Added by Frank Sweetser about 13 years ago
- ID 308be2fcb8a1b63cc934558533552eeb2f852aad
lib/proxy/util.rb | ||
---|---|---|
# if path is ommited will search only in user PATH
|
||
def which(bin, *path)
|
||
path += ENV['PATH'].split(File::PATH_SEPARATOR)
|
||
path.uniq.each do |dir|
|
||
path.flatten.uniq.each do |dir|
|
||
dest = File.join(dir, bin)
|
||
return dest if FileTest.file? dest and FileTest.executable? dest
|
||
end
|
Also available in: Unified diff
fixes #801 - Flatten path before iterating
Signed-off-by: Frank Sweetser <fs@wpi.edu>