• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get the current classic Sytem folder path?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: How to get the current classic Sytem folder path?
      • From: Tackel <email@hidden>
References: 
 >Re: How to get the current classic Sytem folder path? (From: Steven Frank <email@hidden>)

  • Prev by Date: Re: Code Completion
  • Next by Date: Cocoa/Java - NSNotification not received.
  • Previous by thread: Re: How to get the current classic Sytem folder path?
  • Next by thread: Re: How to get the current classic Sytem folder path?
  • Index(es):
    • Date
    • Thread