Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Cygwin 中,路径中的空格必须用反斜杠转义 在 Windows 中不正确,将整个路径放在引号中
有没有办法在 Ruby 中自动转换为这个?
否则,如何在 Ruby 中检测我是使用 Windows 还是 Cygwin 运行?
Cygwin 中的引用路径应该可以正常工作。
http://rant.rubyforge.org/
sys.escape("foo bar") # gives on Windows: '"foo bar"' # other systems: 'foo\ bar'
我至少找到了如何检测平台 - RUBY_PLATFORM 常量定义了这一点。