PDA

View Full Version : Folder Size




jim93
Jul 13, 2009, 05:15 AM
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)



kainjow
Jul 13, 2009, 07:02 AM
I would imagine this wouldn't work because of permission issues on the iPhone (?).

PhoneyDeveloper
Jul 13, 2009, 12:44 PM
Look at NSFileManager and methods like attributesOfItemAtPath:error:

jim93
Jul 14, 2009, 04:22 AM
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.

PhoneyDeveloper
Jul 14, 2009, 12:03 PM
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.