ironruby - 如何获取 IronRuby 中的当前工作目录?

标签 ironruby

我想知道如何读取由 IronRuby“解析”的文件的当前工作目录。看起来“执行目录”与ir.exe文件相同。

我需要它来创建 XNA 解决方案中内容的相对路径,而不需要对路径进行硬编码。

最佳答案

来自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"

关于ironruby - 如何获取 IronRuby 中的当前工作目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1248558/

相关文章:

ruby - 如何在 Ironruby 中使用 Ruby 库

IronRuby - 如何要求没有强名称的 .NET 程序集?

c# - 使用 IronRuby 或 IronPython 修改 C# 对象列表

.net - IronRuby 性能?

.net - IronRuby ScriptSource.Execute 线程安全吗?

rubygems - 我可以在 ironruby 中运行 ruby​​gems 吗?

ruby-on-rails - Redmine和IronRuby(Windows)?

error-handling - IronRuby 堆栈跟踪

ironpython - IronPython 和 IronRuby 的当前标准合规级别

c# - 使用 IronRuby 包装器方法将 block 放入 C#