Re: How to get the current classic Sytem folder path?
Re: How to get the current classic Sytem folder path?
- Subject: Re: How to get the current classic Sytem folder path?
- From: Greg Robbins <email@hidden>
- Date: Thu, 6 Mar 2003 19:16:23 -0800
GetFolderName is not the proper way to get the System Folder name. As the docs for that routine say,
---
The GetFolderName function obtains the name of the folder in the folder descriptor, not the name of the folder on the disk. The names may differ for a few special folders such as the System Folder. For relative folders, however, the actual name is always returned.
---
GetFolderName is returning "\pSystem" because the actual system folder isn't located by name by the system.
Instead, use FSFindFolder and FSGetCatalogInfo to get the name:
FSRef systemFSRef;
OSErr err = FSFindFolder(kClassicDomain, kSystemFolderType, kDontCreateFolder, &systemFSRef);
if (err == noErr)
{
HFSUniStr255 hfsUniName;
err = FSGetCatalogInfo(&systemFSRef, kFSCatInfoNone, NULL, &hfsUniName, NULL, NULL);
if (err == noErr)
{
NSString *name = [NSString stringWithCharacters:hfsUniName.unicode
length:hfsUniName.length];
NSLog(name);
}
}
Greg Robbins
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.