c:\winmoff\folderforvirus32 => is correct path (on Win Sys, but not under Unixes)
c:\winmoff\\folderforvirus32 => is incorrect (everyware, I think)
$ mkdir /tmp/test
$ cd /tmp/test
$ mkdir 'c:\winmoff\folderforvirus32'
$ mkdir 'c:\winmoff\\folderforvirus32'
$ ls -1
c:\winmoff\\folderforvirus32
c:\winmoff\folderforvirus32
$ uname
Linux
$
Testing whether a path is valid under Unix is easy: as long as it doesn't contain "\x00" (NUL character in C) it's a valid path. Any other character is valid, and only / is special: it separates the path components. Hence, in a component (file- or directoryname), all characters, except the NUL character and the slash are allowed.
| [reply] [d/l] [select] |
Hi,
you probably mean if a path is syntactically correct. Well, that's sometimes hard to tell as on Windows you have the backslash as a separator and certain other characters are not allowed whereas under Unix you use the forward slash (aka slash ;-)) as the delimiter while at the same time the backslash is a widely used character used to mask the next character (e.g. a space).
This leaves you with the problem of how to know if a backslash is used to mask the next character or if it is a Windows path.
But there are ways to translate Windows paths to Unix and vv.
Regards,
svenXY | [reply] |
The backslash is only used to prevent the shell from processing special characters. There's no reason to deal with backslashes yourself - if you write a regex, you aren't dealing with any backslashes that might be in the query string as well, are you?
| [reply] |
Just look at the bottom left of your screen. As long as there's no windows symbol, the spelling is correct. Otherwise, who cares ;)Update: Actually I am lying - the spelling can also be incorrect on other legacy systems than windows, such as VMS, OS400 etc. More to the point, Perl will translate unix/linux paths in filename context into whatever is correct for the actual platform.
| [reply] |