Re: Carbon : start-up volume name/path as POSIX
Re: Carbon : start-up volume name/path as POSIX
- Subject: Re: Carbon : start-up volume name/path as POSIX
- From: MacInsight <email@hidden>
- Date: Fri, 30 May 2003 15:00:14 +0200
Hi,
Am Freitag, 30.05.03 um 13:42 Uhr schrieb Cristian Savu:
Hello list,
Can someone tell me how can I detect the start-up volume (POSIX) using
Carbon ?
I am trying to differentiate this volume from the other volumes.
Thanks in advance,
Cristian
Maybe this would better be asked on the carbon-development mailing
list...?
Anyway, yesterday there has been an answer to a similiar question in
the thread "Getting Application Path";
with little changes, maybe it's useful for your intends too.
hth,
Dirk Stegemann
--------------------schnipp--------------------
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
--------------------schnapp--------------------
_______________________________________________
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.