How do I detect how to escape spaces in a path
Question
In Cygwin a space in a path has to be escaped with a backslash Not true in Windows, put the whole path in a quote
Is there a way to convert to this automatically in Ruby?
Otherwise, how in Ruby do I detect if I am running with Windows or Cygwin?
Solution
sys.escape("foo bar")
# gives on Windows: '"foo bar"'
# other systems: 'foo\ bar'
OTHER TIPS
Quoting paths in Cygwin ought to work fine.
I found how to detect the platform at least - the RUBY_PLATFORM constant defines that.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow