我想知道如何读取 IronRuby 正在“解析”的文件的当前工作目录。看起来“执行目录”与 ir.exe 文件相同。
我需要它来创建 XNA 解决方案中内容的相对路径,而无需对路径进行硬编码。
我想知道如何读取 IronRuby 正在“解析”的文件的当前工作目录。看起来“执行目录”与 ir.exe 文件相同。
我需要它来创建 XNA 解决方案中内容的相对路径,而无需对路径进行硬编码。
从类:目录:
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"
我想我在 Dir.pwd 中找到了解决方案
愚蠢的我忘记了 pwd 不是密码的首字母缩写词,而是打印工作目录的首字母缩写词......
尴尬:)
如果您愿意,也可以使用 CLR 的处理方式:
include System
Environment.current_directory => clr_string