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



Actually one might want to use the CFURL stuff if one is using MIB from Apple since it uses CFURLs a lot in its APIs. Or if one needs CFURLs to interoperate with other CF routines.

Michael
Orbital Launch & Lift, Inc.
http://www.orbitallaunch.com

At 2:28 PM -0500 11/21/04, Laurence Harris wrote:
On 11/21/04 1:42 PM, Turbo3D didst favor us with:

> And now that we have the user directory, how to create a private
 folder into it and then create some  file this folder .
 We got the FsRef of the user domain, but how to get a FsRef ( then a
 FsSpec) to a non existing folder/file path ?

Why do you need an FSRef to an non-existent file or folder (not possible, by the way)?

Why are you screwing around with this CFURL stuff? Have you not read through
Files.h?

extern OSErr
FSCreateDirectoryUnicode(
  const FSRef *          parentRef,
  UniCharCount           nameLength,
  const UniChar *        name,
  FSCatalogInfoBitmap    whichInfo,
  const FSCatalogInfo *  catalogInfo,       /* can be NULL */
  FSRef *                newRef,            /* can be NULL */
  FSSpec *               newSpec,           /* can be NULL */
  UInt32 *               newDirID)          /* can be NULL */
AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;

extern OSErr
FSCreateFileUnicode(
  const FSRef *          parentRef,
  UniCharCount           nameLength,
  const UniChar *        name,
  FSCatalogInfoBitmap    whichInfo,
  const FSCatalogInfo *  catalogInfo,       /* can be NULL */
  FSRef *                newRef,            /* can be NULL */
  FSSpec *               newSpec)           /* can be NULL */
AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;

Read the headers. It will save you more time than you'll waste wandering
around in the dark like this.

 OSStatus err = FSFindFolder(kUserDomain, kCurrentUserFolderType,
 FALSE, &fsRef);
 CFURLRef home = CFURLCreateFromFSRef(kCFAllocatorDefault, &fsRef);
 CFURLRef path =
 CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault, home,
 CFSTR("SomeFolder"), TRUE);
 bOK= CFURLGetFSRef(path, &fsRef);  // Does not work .... the folder
 must already exist !... shit

Very professional. Thanks for sharing that with us.

Larry

 result = FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL,
 &outSpec, NULL);
 CFRelease(home);
 CFRelease(path);
 FSMakeFSRefUnicode  does not work either.

Thanks

_______________________________________________ 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

_______________________________________________ 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: Laurence Harris <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.