Forum: Ruby Re: Full paths of Ruby interpreter and running script

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
William (Bill) Froelich (Guest)
on 2006-04-18 01:54
(Received via mailing list)
Well the full path to the running script is easy enough to get from
within Ruby and based on your needs might suffice for finding the
configuration file at runtime.

puts File.expand_path(__FILE__)    # c:/rubytest/test.rb

If you want just the directory then use this

puts File.dirname(File.expand_path(__FILE__))	# c:/rubytest

Hope this helps!

--Bill
This topic is locked and can not be replied to.