15 May 15:55
Re: finding current drive
From: Lars Christensen <larsch <at> belunktum.dk>
Subject: Re: finding current drive
Newsgroups: gmane.comp.lang.ruby.general
Date: 2008-05-15 13:55:10 GMT
Subject: Re: finding current drive
Newsgroups: gmane.comp.lang.ruby.general
Date: 2008-05-15 13:55:10 GMT
On May 15, 3:44 pm, "Parv G." <ghotr...@yahoo.com> wrote: > Is there a way to find out under what drive my current/active file is? > > if the .rb file i'm working on is sitting in c:/code/ruby/myfile.rb, i > would like to find a way to retrieve "c". Dir.pwd - if you want to find out what the "working directory" is, i.e. where the user was when he launched the script. File.expand_path($0) - if you want to find what script was run from the command line. File.expand_path(__FILE__) - if you want to find the path to the current script file. Lars
RSS Feed