Re: Getting path of current script


Is there a simpler way to get the absolute path of the current script?

path = File.dirname(File.expand_path(FILE))

Under some circumstances (like, you haven’t changed the working
directory, and you can ensure that the working directory is the same as
the script) Dir.pwd might be all you need, right?

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