From: "Roger B. Atkins" Date: 2010-01-01T11:25:31+09:00 Subject: Re: Path problems Thanks Darryl. I used SciTE to put your code in a file named test3.rb and saved it. I closed the file, opened it again, pressed F5 and: >ruby test3.rb >The system cannot find the file specified. Then I saved the file to the same directory where ruby is located, closed it, opened it again in SciTE and it worked: >ruby test3.rb reveal Filename and Dirname attributes a - the current directory => . b - the current filename => test3.rb c - the current directory and filename => test3.rb d - same output as 'a' only using $0 => . e - same as 'c' only using $0 => test3.rb f - same as 'c' only using $PROGRAM_NAME => test3.rb >Exit code: 0 In between attempts, I did some playing at the command prompt. In the process I remembered that DOS doesn't recognize directory names containing multiple words with spaces between them. Since my earlier source files are all in a directory named "Ruby Files", I thought the directory name might be part of the problem. I changed the directory name to RubyFiles, but it did not solve the problem. I notice that now SciTE shows "ruby test3.rb" before the results, whereas earlier it was just showing the file name without "ruby " in front of it. Perhaps the active directory changed in SciTE. Anyway, I will put all my files in the directory with ruby since I can't seem to control SciTE. Thanks again and Happy New Year! RBA Darryl (gem dandy) Brown wrote: > On Dec 31, 7:12 pm, Luis Lavena wrote: > >> On Dec 31, 9:01 pm, "Roger B. Atkins" wrote: >> >> >>> Thanks Darryl. >>> >>> The error message: >>> >ruby Test2.rb >>> >The system cannot find the file specified. >>> >> are you invoking ruby in the directory where "Test2.rb" exist? >> >> Also, is the file named "Test2.rb" and not "test2.rb", things are case >> sensitive sometimes. >> >> -- >> Luis Lavena >> > > Hello again Roger, > > Sorry if I threw too much at you.... > (__FILE__) is a ruby keyword that holds the dir & file of the > program that it's used in. > > Copy the below snippet into a file and run it for a better feel. > > > > $:.unshift File.dirname(__FILE__) unless > $:.include? File.dirname(__FILE__) > > puts "reveal Filename and Dirname attributes \n\n" > a = File.dirname(__FILE__) > b = File.basename(__FILE__) > c = (__FILE__) > d = File.dirname $0 > e = $0 > f = $PROGRAM_NAME > > puts " a - the current directory => #{a}" > puts " b - the current filename => #{b}" > puts " c - the current directory and filename => #{c}" > puts " d - same output as 'a' only using $0 => #{d}" > puts " e - same as 'c' only using $0 => #{e}" > puts " f - same as 'c' only using $PROGRAM_NAME => #{f}" > > > > Regards, > Darryl > > >