#1640 path separator

motonao Sat 10 Sep 2011

To get the File from relative path name on Windows. It seems to need to pass the file path separated by /.

\\ didn't work.

ex)
  >`sub/test.txt`.toFile.exists  =>true
  >`sub\\test.txt`.toFile.exists  =>false

Can't I use \\ in this case ?

go4 Sat 10 Sep 2011

The Uri is platform independent. File.os(Str osPath) may be you want.

brian Sat 10 Sep 2011

As a general rule, you should use Uri and "/" slash everywhere you can to avoid nasty platform issues. If you really need to work with platform specific paths (such as user input/output points) you can use sys::File.os and sys::File.osPath.

motonao Sat 10 Sep 2011

sys::File.os is indeed what I want. I couldn't find in the documents. Thanks for answering the simple question.

Login or Signup to reply.