From: GianFranco Bozzetti Date: 2010-10-20T16:20:14+09:00 Subject: Re: Separator in $PATH string#split accept a regular expression path_list = ENV['PATH'].split(/[:;]/) # work s on Linus and Windows HTH gfb "Stefano Mioli" wrote in message news:AANLkTikcTzTvNbejW6JEL9_tmBAvKBqer7_W1X6p20M_@mail.gmail.com... 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