in reply to Unify windows filenames
And then there's the macosx adaptation of openBSD unix, where (in contrast to every other type of unix-based or unix-like OS I know of) case distinctions are ignored. I just tried this on my mac, and was quite saddened by the result:
I see that File::Spec has a "case_tolerant()" function, which (according to the man page) is supposed to return "a true or false value indicating, respectively, that alphabetic case is not or is significant when comparing file specifications."$ echo foobar > /tmp/junk $ cat /tmp/junk foobar $ cat /tmp/JUNK foobar $ echo hello > /tmp/JUNK $ cat /tmp/junk hello $ cat /tmp/JUNK hello
But having tried that just now on macosx, I find that it returns false (case is significant), despite the fact that case is demonstrably not significant for distinguishing paths on macosx. I think that's something that needs to be fixed in File::Spec.
(I'm still using the Perl 5.8.8 that shipped with macosx 10.5.8 -- maybe this was fixed in Perl 5.10?)
So to succeed in your cross-platform intentions, you yourself have to check the value of $^O -- if it's "darwin", you have to fold case; if it's "MSWin32", you have to fold case and slashes; anything else, you leave all characters as-is.
(updated to fix link to module page)
(updated to change "mswin" to "MSWin32", which is what File::Spec looks for)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Unify windows filenames
by Anonymous Monk on Sep 20, 2009 at 02:40 UTC | |
by graff (Chancellor) on Sep 20, 2009 at 03:59 UTC | |
by Your Mother (Archbishop) on Sep 20, 2009 at 04:55 UTC | |
by graff (Chancellor) on Sep 20, 2009 at 15:19 UTC | |
by Anonymous Monk on Sep 20, 2009 at 18:10 UTC | |
| |
by afoken (Chancellor) on Sep 23, 2009 at 04:18 UTC | |
by Anonymous Monk on Sep 20, 2009 at 04:17 UTC |