Re: Full paths of Ruby interpreter and running script

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!


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs