File permissions under Lion

Archives Forums/MacOS X Discussion/File permissions under Lion

JazzieB(Posted 2012) [#1]
So I finally got around to installing Lion alongside Snow Leopard on my Mac for testing my game. So I then copied the game over from the SL partition into the Applications folder of the Lion installation and ran it...

Game seemed to work fine, until I tried to play it. None of the level files were copied from the AppBundle to the /Library/Application Support folder! These and no config files were saved either!

Everything ran fine under SL, so what's going on here? I can only assume that the file permissions are different under SL than they are under Lion, which is preventing my game from creating the folders and files it needs to.

The game was compiled under SL using X-Code 3.2.6. Would compiling under Lion with the latest version of X-Code fix this, or do I need to do something else to give the game the required permissions to write to the Application Support folder.

I'm hoping that someone has hit this problem and will be able to help. Otherwise I've got some figuring out to do before I release a Mac version of my game (which I was hoping to do Friday!).

Any help appreciated.

Last edited 2012


JazzieB(Posted 2012) [#2]
Looks like the problem is down to default file permissions for an admin on the Library/Application Support folder. Under Snow Leopard it's read/write, but under Lion it's read only. Obviously I can change these manually, but I can't expect a customer to do that, so I need to find a way of allowing my game to run with read/write access. No idea how I'm going to do that.

My only other option is to go back to using the Shared folder, but this goes against best practice and won't be accepted if I decide to submit to the AppStore.

Another option would be to use the user's Library folder, but this is hidden under Lion so I would need to work around that as well. But the downside to this is that this folder will only be accessible to the user who first ran the game. In fact, I believe this also goes against Apple's guidelines, as they don't want applications making changes to anything in the User's folder.

Wish I'd bought Lion earlier to sort these things out now!


Winni(Posted 2012) [#3]
I think an AppStore app has no business in the /Library/Application Support folder at all, you're supposed to only use the respective user's home folder. I don't know about the guidelines for ~/Library/..., or if there even are any, but there are many hidden files in my home directory from various applications and Time Machine archives them anyway. The reason why there are hidden is to prevent the user from doing anything stupid with them, like, for example, moving them into the trash bin by accident. Other than that, my expectation is that it should be perfectly okay for an app to write to the user's ~/Library folder structure.

Also, I'm not sure if it's still a priority in Apple land to support Snow Leopard. I don't know what the remaining market share is, but obviously even RAGE gets away with being a Lion-only-game. But then again, people who buy RAGE probably also are quick to buy a new OS version. But in the Apple ecosystem, the customers are used to fast upgrade cycles; this is not the Windows world where people are still holding on to a 12 year old operating system...


JazzieB(Posted 2012) [#4]
Thanks Winni.

The /Library/Application Support folder was the accepted place to store files to be shared between users (a high score table, for example). There have been discussions on this matter on the forum and I know that people have had apps accepted by the AppStore. They used to be rejected if the Users/Shared folder were used.

The ~/Library/Application Support folder was also the place to store any user related data. However, with Lion that folder is now hidden - although I'm not bothered if the user can see it or not.

However, all the above could be for nothing, as I've just seen the thread about Sandboxing and this throws a lot of other issues around. A Sandboxed app can only access files within it's own bundle or it's "container" folder, which is again, per user. Permissions can be given to an app to access certain folders outside, but I have no idea how to do this, and I haven't seen mention of where to store shared files anyway!

I'm beginning to think I should just store the data in the user's folder and if more than one person wants to play it, they need to do so from the same account.