Re: Getting Application Path
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.