• 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: Getting Application Path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Application Path


  • Subject: Re: Getting Application Path
  • From: Tomas Zahradnicky <email@hidden>
  • Date: Thu, 29 May 2003 12:01:20 +0200

Dear all,

I have no problem to get my application path. However, is it possible to get
the volume name of the application as well. Many Thanks.

Regards,

Anthony


Hello Anthony,

if you don't mind linking against Carbon.framework, here's what you need.


-Tomas


- (NSString*)getApplicationVolumeName
{
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef url = CFBundleCopyBundleURL( mainBundle );
FSRef bundleRef;
FSCatalogInfo info;
HFSUniStr255 volName;
NSString* outVolumeName = NULL;

if( url )
{
if( CFURLGetFSRef(url, &bundleRef) )
{
if( FSGetCatalogInfo(&bundleRef, kFSCatInfoVolume, &info, NULL, NULL, NULL) == noErr )
{
if( FSGetVolumeInfo ( info.volume, 0, NULL, kFSVolInfoNone, NULL, &volName, NULL) == noErr )
{
outVolumeName = [NSString stringWithCharacters:volName.unicode length:volName.length];
}

}
}

CFRelease(url);
}

return outVolumeName;
}
--
Ing. Tomas Zahradnicky, Jr.
Production Manager, 24U Software
Associate Member, Filemaker Solutions Alliance
mailto:email@hidden
http://www.24uSoftware.com
_______________________________________________
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.

References: 
 >Re: Getting Application Path (From: Rolf <email@hidden>)
 >Re: Getting Application Path (From: "Anthony Cheung" <email@hidden>)

  • Prev by Date: Re: Getting Application Path
  • Next by Date: Re: Getting Application Path
  • Previous by thread: Re: Getting Application Path
  • Next by thread: Re: Getting Application Path
  • Index(es):
    • Date
    • Thread