Folder Size

Discussion in 'iOS Programming' started by jim93, Jul 13, 2009.

  1. jim93 macrumors newbie

    Joined:
    Jun 27, 2009
    #1
    Does anyone know if there is some way to find out the current size of the folder your application is in to display to the end-user? (Assume this has to done through a programmed method since folder size is not static)
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    I would imagine this wouldn't work because of permission issues on the iPhone (?).
     
  3. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    Look at NSFileManager and methods like attributesOfItemAtPath:error:
     
  4. jim93 thread starter macrumors newbie

    Joined:
    Jun 27, 2009
    #4
    That looks like it should work at least for my app not sure if it will work to find out space left for apps. I know the permissions are not for writing but are there read permissions outside of your apps sandboxed space.
     
  5. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    I haven't monkeyed around with files outside the app sandbox so I don't know what the permissions are for those files. You'll have to try it yourself. Having said that, I'm pretty sure that Apple won't allow an app on the app store that displays info from parts of the file system outside the app's sandbox.

    The restrictions to the sandbox are more than just unix file permissions, I think. There is a mobileuser user and root. There are probably some other user accounts but they are all some form of root or not mobileuser. Normally a user could see all the files that are owned by that user. So under a standard unix file system set up when an app is running it should be able to inspect other folders than its own, but this doesn't work. So the file system has other restrictions besides the standard unix file permissions restrictions, I think.
     

Share This Page