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

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

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:
    479
    Peter Blatt
    Oct 9, 2004
  2. shraddha
    Replies:
    10
    Views:
    6,457
    shraddha
    May 31, 2005
  3. Brian
    Replies:
    2
    Views:
    2,978
    Brian
    Dec 27, 2004
  4. Replies:
    7
    Views:
    513
  5. Replies:
    0
    Views:
    817
  6. Yeounkun, Oh

    How can I get a name of function running currently.

    Yeounkun, Oh, Nov 16, 2004, in forum: C Programming
    Replies:
    2
    Views:
    543
    Stuart Gerchick
    Nov 16, 2004
  7. Sean Farrow
    Replies:
    1
    Views:
    370
  8. alex goretoy
    Replies:
    0
    Views:
    625
    alex goretoy
    Jan 15, 2009
Loading...