• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to canonicalize the case of a filename or path?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How to canonicalize the case of a filename or path?
      • From: Quinn <email@hidden>
  • Prev by Date: Re: Can i rely on inode numbers?
  • Next by Date: Re: How to canonicalize the case of a filename or path?
  • Previous by thread: Re: Can i rely on inode numbers?
  • Next by thread: Re: How to canonicalize the case of a filename or path?
  • Index(es):
    • Date
    • Thread