我想知道如何读取正在被IronRuby“解析”的文件的当前工作目录。“执行目录”似乎与ir.exe文件相同。
我需要它来创建XNA解决方案中内容的相对路径,而无需对路径进行硬编码。
发布于 2009-08-08 11:07:32
来自Class:Dir
Dir.getwd => string
Dir.pwd => string
Returns the path to the current working directory of this process as a string.
Dir.chdir("/tmp") #=> 0
Dir.getwd #=> "/tmp"
发布于 2009-08-08 11:06:24
我想我在Dir.pwd中找到了解决方案
我忘了pwd不是密码的首字母缩写,而是打印工作目录的首字母缩写...
尴尬:)
发布于 2009-08-16 20:59:10
如果你喜欢,你也可以使用CLR的方式来做事情:
include System
Environment.current_directory => clr_string
https://stackoverflow.com/questions/1248558
复制相似问题