Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > How to find directory of currently running .rb file

Reply
Thread Tools

How to find directory of currently running .rb file

 
 
Kenneth McDonald
Guest
Posts: n/a
 
      10-27-2008
__FILE__ is just giving me the file name, with no path, and Dir.getwd
is giving me an error: "ENOENT: No such file or directory." What is
the proper way to get this info?

Thanks in advance,
Ken McDonald

 
Reply With Quote
 
 
 
 
Brian Candler
Guest
Posts: n/a
 
      10-27-2008
Kenneth McDonald wrote:
> __FILE__ is just giving me the file name, with no path, and Dir.getwd
> is giving me an error: "ENOENT: No such file or directory." What is
> the proper way to get this info?


File.dirname(__FILE__)
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
RE: How to find a file or a device is currently used by whichprocessor which program ? Tim Golden Python 0 10-11-2006 09:27 AM
How to find a file or a device is currently used by which processor which program ? fdu.xiaojf@gmail.com Python 0 10-10-2006 08:17 AM
How do you get a list of files currently in a directory?? Rob_S C++ 2 03-01-2006 12:58 PM
"Directory Service is currently unavailable" =?Utf-8?B?U3VzaWUtUQ==?= Windows 64bit 3 12-16-2005 09:36 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57