Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 323823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:03:59+00:00 2026-05-12T09:03:59+00:00

For my app I need to use the Carbon file manager API to get

  • 0

For my app I need to use the Carbon file manager API to get the size of a folder (NSEnumerator is slow, and using NSTask with a shell command is even worse). I’ve imported the Carbon framework, and I’m using this method to get the size of a folder:

http://www.cocoabuilder.com/archive/message/cocoa/2005/5/20/136503

It uses an FSRef as an argument, and my path string is currently an NSString. I tried using this to convert the NSString to an FSRef:

FSRef f;
        OSStatus os_status = FSPathMakeRef((const UInt8 *)[filePath fileSystemRepresentation], &f, NULL);

        if (os_status != noErr) {
            NSLog(@"fsref creation failed");
        }

And then I called the folder size method:

[self fastFolderSizeAtFSRef:f];

However when I try to build, I get this error regarding the above line:

error: incompatible type for argument one of ‘fastFolderSizeAtFSRef:’

Any help would be appreciated. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:04:00+00:00Added an answer on May 12, 2026 at 9:04 am

    The “fastFolderSizeAtFSRef” method takes an FSRef* (FSRef pointer). You’re giving it an FSRef. It’s a one character fix, luckily enough. You have:

    [self fastFolderSizeAtFSRef:f];
    

    Simply change that to:

    [self fastFolderSizeAtFSRef:&f];
    

    And you should be good to go. However, I was implementing this same method yesterday but was having trouble creating the FSRef itself. I eventually went with the following code:

    FSRef convertNSStringToFSRef(NSString * theString) {
        FSRef output;
        const char *filePathAsCString = [theString UTF8String];
        CFURLRef url = CFURLCreateWithBytes(kCFAllocatorDefault, 
                                            (const UInt8 *)filePathAsCString, 
                                            strlen(filePathAsCString),
                                            kCFStringEncodingUTF8,
                                            NULL);
        CFURLGetFSRef(url, &output);
        CFRelease(url);
        return output;
    }
    

    This has been working flawlessly for me.

    EDIT: I just open sourced the code that I’m using this in. It’s these files:

    This file adds a method to NSFileManager that uses an FSRef to find the complete size of a directory.
    This file adds a method to NSString that will convert it to an FSRef.
    Everything happens on line 46 of this file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an app that will need to make use of Timer s, but
I am building a web app where I need to get all the images
I'm writing an android app where I need to use AES. Is it better
I need to use a 3rd party dll in our main app. When I
I need use images in 2 .NET assemblies. One is WPF app {myApp.exe} and
I'm creating my first android app and I need to use a service. The
I'm working on a Facebook iFrame App and i need to use ajax request
I'm working on a Facebook iFrame App and i need to use ajax request
i need to use Base64 on my app (import android.util.Base64;) but Base64 was included
In my app i need to save changed values (old and new) when model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.