mac-to-posix-filename

Immanuel Litzroth <[email protected]> 29 Jul 2002 12:26:53 +0200
Newsgroups gmane.emacs.macintosh.devel
Message-ID <[email protected]>
I have changed the posix_to_mac_pathname and mac_to_posix_pathname
functions in mac.c to use the CFxxx functions so that they are
properly aware of mount points etc. My emacs has been working
properly with these for about a week.
Immanuel.

#ifdef MAC_OSX
int
posix_to_mac_pathname(const char* ufn, char *mfn, int mfnbuflen)
{
   CFStringRef thePosixPath = CFStringCreateWithCString(NULL,
							ufn,
							kCFStringEncodingMacRoman);
   CFURLRef theURLRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
						      thePosixPath,
						      kCFURLPOSIXPathStyle,
						      false);
   CFStringRef theMacPath = CFURLCopyFileSystemPath(theURLRef,
						      kCFURLHFSPathStyle);
   CFStringGetCString(theMacPath,
		      mfn,
		      mfnbuflen,
		      kCFStringEncodingMacRoman);
   
   CFRelease(theMacPath);
   CFRelease(theURLRef);
   CFRelease(thePosixPath);
   return true;
}

mac_to_posix_pathname(const char* mfn, char* ufn, int ufnbuflen)
{
   CFStringRef theMacPath = CFStringCreateWithCString(NULL,
						      mfn,
						      kCFStringEncodingMacRoman);
   CFURLRef theURLRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
						      theMacPath,
						      kCFURLHFSPathStyle,
						      false);
   CFStringRef thePosixPath = CFURLCopyFileSystemPath(theURLRef,
						      kCFURLPOSIXPathStyle);
   CFStringGetCString(thePosixPath,
		      ufn,
		      ufnbuflen,
		      kCFStringEncodingMacRoman);
   CFRelease(theMacPath);
   CFRelease(theURLRef);
   CFRelease(thePosixPath);
   return true;
}
#else // old functions

***************************************************************************
His endeavours to improve these conditions by innovations in the
current methods of teaching are fully described in his writings; these
made him unpopular with his brethren in the order and led to his
removals to the monastery of Pomposa near Ferrara, Italy. Here the
same lot seems to have befallen him. 
About Guido of Arezzo

Immanuel Litzroth
Software Development Engineer
Enfocus Software
Kleindokkaai 3-5
B-9000 Gent
Belgium
Voice: +32 9 269 23 90
Fax : +32 9 269 16 91
Email: [email protected]
web : www.enfocus.be
***************************************************************************



-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31