Ruby Forum Ruby > finding current drive

Posted by Parv G. (parvg)
on 15.05.2008 15:44
hello,

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".

Thanks!
Posted by Lars Christensen (Guest)
on 15.05.2008 15:56
(Received via mailing list)
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
Posted by Parv G. (parvg)
on 15.05.2008 16:07
> 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

thanks!  i could work with these.

Parv
Posted by Sylvain COURTECUISSE (Guest)
on 15.05.2008 16:35
(Received via mailing list)
unsuscribe


**************************
Si vous n'etes pas le destinataire designe de ce message ou une personne 
autorisee a l'utiliser, toute distribution, copie, publication ou usage 
a quelques fins que ce soit des informations dans ce message sont 
interdits. Merci d'informer immediatement l'expediteur par messagerie, 
et, de detruire ce message.
This e-mail is confidential. If you are not the addressee or an 
authorized recipient of this message, any distribution, copying, 
publication or use of this information for any purpose is prohibited. 
Please notify the sender immediately by e-mail and then delete this 
message.
**************************