I have a Ruby script which wants to determine its absolute path in order to find some data files that are stored relative to the script.
我有一个Ruby脚本,它想要确定它的绝对路径,以便找到一些相对于脚本存储的数据文件。
What's the simplest/best way to do this?
最简单/最好的方法是什么?
1 个解决方案
#1
13
This can be done simply using:
这可以简单地使用:
File.expand_path $0
#1
13
This can be done simply using:
这可以简单地使用:
File.expand_path $0