Re: Determining the canonical case for a file name on HFS+
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Dec 1, 2005, at 12:02 PM, darwin-dev-request@lists.apple.com wrote: Send Darwin-dev mailing list submissions to I am looking for a way to determine the canonical form for a file name. Suppose that there is a file named "FILE" in the directory / folder/, which is on an HFS+ volume: then the canonical form of the path "/folder/file" would be "/folder/FILE". Both paths refer to the same file, but the representation on disk is FILE. I need to know this for the purpose of comparison, and I cannot simply do a case-insensitive comparison because I do not know if / folder/ is on a case-insensitive or case-sensitive volume. I have thought of opening the file and then using fstat on the descriptor, but is there a better way to do it? Stat the two paths and compare the inode number for each. This is of course subject to a race with rename, but it avoids the overhead associated with actually opening the file. From a broader point of view, what I need is a reliable solution for determining if two paths refer to the same file, without assuming anything about the filesystem on which it is located. I have searched the archives of this list, but I could not find an answer to this question. That would be because there isn't one that can be reliably applied to the namespace. File/path names are indices, they don't tell you anything about the actual structure of the data being indexed. As such, the information you're looking for simply isn't there. = Mike _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Mike Smith