__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
__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
__FILE__ gives you the path it was called with, if your Ruby script is
in the current working directory it will return “./foo.rb” if it is in
/usr/local/bin __FILE__ will be “/usr/local/bin/foo.rb”. If you want
the full path instead of “./” Dir.getwd should work.
On Mon Oct 27 19:01:04 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?
--
Fred O. Phillips
BBC7 7572 755F 83E0 3209 504A E4F7 874F 1545 9D41
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/\.