• 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: Carbon : start-up volume name/path as POSIX
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Carbon : start-up volume name/path as POSIX (From: "Cristian Savu" <email@hidden>)

  • Prev by Date: Re: Accessing objective-c from c
  • Next by Date: Re: Threads, messages and blocking
  • Previous by thread: Carbon : start-up volume name/path as POSIX
  • Next by thread: Re: Carbon : start-up volume name/path as POSIX
  • Index(es):
    • Date
    • Thread