1

Possible Duplicate:
How to determine the OS path separator in JavaScript?

I am looking for the JavaScript constant that is equivalent to Java's: File.separator

couldn't find the answer to this question here

Community
  • 1
  • 1
Spiderman
  • 9,602
  • 13
  • 48
  • 56
  • 1
    possible duplicate of [How to determine the OS path separator in JavaScript?](http://stackoverflow.com/questions/125813/how-to-determine-the-os-path-separator-in-javascript). Rather than posting a duplicate, you should add a comment and a bounty to the other question. – Andy E Jan 17 '11 at 11:49
  • @Andy E the task is different, so it's not exactly a duplicate. – Eugene Mayevski 'Callback Jan 17 '11 at 14:06
  • @Eugene: yet the marked accepted answer is pretty much the same as the one in the other question. – Andy E Jan 17 '11 at 14:23
  • @Andy the answer also has comments and I assume it was actually a comment that was accepted. – Eugene Mayevski 'Callback Jan 17 '11 at 15:03
  • @Eugene: there's no way of knowing for sure and besides, comments *aren't answers*. Feel free to read [The Wikipedia of long-tail programming questions](http://blog.stackoverflow.com/2011/01/the-wikipedia-of-long-tail-programming-questions/) for more information. – Andy E Jan 17 '11 at 15:41

2 Answers2

0

What didn't you like in the accepted answer of the referenced question? You can always use forwrd slash. cmd.exe accepts "cd /temp" correctly, I have just checked this on Windows XP SP2 and on Windows 7.

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121
  • This doesn't help me because I need to parse the content of input file element. I need to know how the OS will create the String- with '/' or with '\' , my page should work both on windows and Linux. – Spiderman Jan 17 '11 at 12:05
  • @Spiderman depending on your exact task you can analyze if input string has "[a-z]:" or "\\" as first characters. If yes, then this is a Windows absolute path (either DOS path or UNC path). – Eugene Mayevski 'Callback Jan 17 '11 at 12:32
0

AFAIK there is no constant you will have to discover the platform and set according.

Lloyd
  • 29,197
  • 4
  • 84
  • 98