How to find directory of currently running .rb file

Discussion in 'Ruby' started by Kenneth McDonald, Oct 27, 2008.

  1. __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
     
    Kenneth McDonald, Oct 27, 2008
    #1
    1. Advertising

  2. 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/.
     
    Brian Candler, Oct 27, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Blatt
    Replies:
    0
    Views:
    400
    Peter Blatt
    Oct 9, 2004
  2. shraddha
    Replies:
    10
    Views:
    6,180
    shraddha
    May 31, 2005
  3. Brian
    Replies:
    2
    Views:
    2,839
    Brian
    Dec 27, 2004
  4. Replies:
    0
    Views:
    734
  5. Tim Golden
    Replies:
    0
    Views:
    816
    Tim Golden
    Oct 11, 2006
Loading...

Share This Page