From: Stefano Mioli Date: 2010-10-20T05:47:02+09:00 Subject: Re: Separator in $PATH On Tue, Oct 19, 2010 at 10:08 PM, Daniel Berger wrote: > > On Oct 19, 2:02 pm, Stefano Mioli wrote: >> The question is: is there some class in the Ruby library that knows >> about this difference? > > File::PATH_SEPARATOR > >> I'm asking this question because I need to figure out if a given >> executable is in the path and, if it does, retrieve its full path. > > require 'ptools' > > File.which('ls') # => '/bin/ls' > > Works on Windows, too, with or without an extension: > > File.which('notepad')     # Works > File.which('notepad.exe') # Also works Many thanks, Dan. I didn't know about ptools, and somehow I just saw File::SEPARATOR, but not File::PATH_SEPARATOR. -- Stefano