Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the current user dir in Carbon



On 11/16/04 1:20 AM, OL&L Lists didst favor us with:

Have you considered using the Carbon approach:

    FSRef    userFolder;
    OSErr    err = FSFindFolder( kUserDomain, kCurrentUserFolderType,
kDontCreateFolder, &userFolder );

if ( err == noErr )
{
    FSRef   lib;
    UniChar name[] = { 'l', 'i', 'b' };
    err = FSMakeFSRefUnicode( &inParentFSRef, 3, name,
kTextEncodingDefaultFormat, &lib );
   
// Delete lib.

}

Larry

> My code basically looks like this, "lib" being the dir inside the
> current user's dir that I want to delete:
> 
> UInt8    *userslibPathPOSIX = "./lib";
> 
> I've tried:
> 
> UInt8    *userslibPathPOSIX = "./lib";
> 
> and
> 
> UInt8    *userslibPathPOSIX = "~/lib";
> 
> and
> 
> UInt8    *userslibPathPOSIX = "Users/~/lib";
> 
> and
> 
> UInt8    *userslibPathPOSIX = "$HOME/lib";
> 
> None of them work.
> 
> Michael
> Orbital Launch & Lift, Inc.
> http://www.orbitallaunch.com
> 
> At 1:16 AM -0500 11/16/04, Ian Krieg wrote:
>> I believe it is "~".  "." is the current working directory, which
>> might be the home directory.  It might be guaranteed by Apple, I
>> don't know, but I know that tilde will always be the home directory,
>> even if other POSIX commands have selected a different working
>> directory.
>> 
>> Ian Krieg
>> 
>>> Isn't the current user directory just specified as "."?
>>> 
>>> Ian
>>> 
>>>> This may be a newbie question, but how do I specify the current
>>>> user directory using a POSIX-style pathname in Carbon? I need to
>>>> delete a directory directly inside the current user directory so I
>>>> need to make a fixed path as a POSIX pathname string and then
>>>> convert it to an FSRef.
>>>> 
>>>> Thanks,
>>>> 
>>>> Michael
>>>> Orbital Launch & List, Inc.
>>>> http://www.orbitallaunch.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Getting the current user dir in Carbon (From: OL&L Lists <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.