How to canonicalize the case of a filename or path?
How to canonicalize the case of a filename or path?
- Subject: How to canonicalize the case of a filename or path?
- From: Jens Alfke <email@hidden>
- Date: Sun, 13 Apr 2008 22:48:22 -0700
Given a path on a case-insensitive filesystem, what's the best way to
canonicalize the path so that the case of each component — or at least
the final component — matches what's on disk? For instance, such a
function would convert the string "/system/LIBrarY" to "/System/
Library".
The closest thing I could find is realpath(3), but the man page says
nothing about changing case.
A complication is that the program that needs this feature [the
Mercurial version-control system] is written in Python and needs to
avoid platform-specific code. There is a standard Python
"os.path.realpath" function, but I tested it in Python 2.5 on Leopard
and it does not alter the case of filenames. So that would rule out
using realpath(3), assuming that's what its Python namesake calls into.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden