Re: Using HFS paths in the standard C libraries
Re: Using HFS paths in the standard C libraries
- Subject: Re: Using HFS paths in the standard C libraries
- From: Steve Christensen <email@hidden>
- Date: Thu, 12 Oct 2006 16:51:52 -0700
On Oct 12, 2006, at 1:35 AM, Ben Staveley-Taylor wrote:
I am porting some legacy code from CodeWarrior to XCode. The old code
was originally written in the days of Mac OS 9 and uses HFS-style
paths
extensively.
Effectively, I want to arrange so that I can write:
fopen("DiskName:FolderName:FileName.txt")
instead of:
fopen("/Volumes/DiskName/FolderName/FileName.txt")
With CodeWarrior it was possible to do this even in Mach-O targets
because you could build your own copy of the MSL C library from the
sources they provided and a configuration define (#define
_MSL_CARBON_FILE_APIS 1, to be specific) would modify the library
to use
HFS-style paths instead of the default POSIX style paths.
Is it possible to do the same trick with Xcode somehow?
I wouldn't think you could, or if you could, not without a lot more
work than is worth it. Let's see: downloading the Darwin standard C
library sources, hopefully being successful at handling both POSIX
and HFS file paths, getting your code to link against it instead of
the standard libraries, then having to maintain your version of the
libraries forever. :-)
I just finished having to update an old cross-platform library that
uses wchar_t based paths. After looking at the code for awhile, it
became apparent that all the path and file I/O code was really shaky,
so I ended up rewriting the Mac versions of the path and file classes
to internally use either an FSRef or a FSRef/HFSUniStr255 pair to
specify an item. Unless you have really good reasons for far backward
compatibility, I'd suggest taking the hit now and modernizing that code.
steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden