[Python-Dev] Mac questions (original) (raw)

Bob Ippolito bob at redivi.com
Tue Jan 4 13:56:34 CET 2005


On Jan 4, 2005, at 7:42 AM, Jack Jansen wrote:

On 4 Jan 2005, at 11:41, Bob Ippolito wrote:

And finally: Is there any other way to find the true spelling of a file except than a linear search with opendir()/readdir()/closedir() ?

Yes, definitely. I'm positive you can do this with CoreServices, but I'm not sure it's portable to Darwin (not Mac OS X). I'm sure there is some Darwin-compatible way of doing it, but I don't know it off the top of my head. I'll try to remember to look into it if nobody else finds it first. I haven't used pure darwin, but I assume it has support for FSRefs, right? Then you could use FSPathMakeRef() to turn the filename into an FSRef, and then FSGetCatalogInfo() to get the true filename.

I believe your assumption is wrong. CoreServices is not open source, and this looks like it confirms my suspicion:

(from <CoreFoundation/CFURL.h>)

#if !defined(DARWIN)

struct FSRef;

CF_EXPORT CFURLRef CFURLCreateFromFSRef(CFAllocatorRef allocator, const struct FSRef *fsRef);

CF_EXPORT Boolean CFURLGetFSRef(CFURLRef url, struct FSRef fsRef); #endif / !DARWIN */

-bob



More information about the Python-Dev mailing list