0

I want a an app that is "self-contained" (I don't know if i use the right word. "putting the app into trash bin will remove everything" is what I meant). But the app requires some resources to run. I usually put those resources into a folder. I want to move those resources into the App folder ( package contents). Can I do that? Is it a good practice to do that?

When I test the app directly running from Xcode, the App runs fine. But if i run it from finder, the app will say fails to create resources folder because permission denied. I checked the app's folder permission - User(me) has read/write access. I am wondering what is causing this different behavior.

The last option is to use Application Support folder, but I don't want to leave trails when user deletes the app.

Can someone help me out here?

1
  • I believe this is the standard for packaging apps on Mac OSX. I also believe that you need to have execute privs on a directory in order to access it. Commented Apr 13, 2012 at 23:27

1 Answer 1

3

Applications live in the directory /Applications, where users don't generally have write access. Requiring an app to have write permission in system folders is extremely bad practice.

Runtime files should live in ~/Library/Application Support. While that folder tends to accumulate some cruft, unless your application leaves behind really large files, that shouldn't be a problem.

If you want your application to be self-contained, it needs to come with all the files it needs from the get-go, and not write anything to disk.

Sign up to request clarification or add additional context in comments.

3 Comments

It sounds to me like the resources in question are not WRITTEN BY the app at runtime, but BUNDLED WITH the app at build time.
@jahroy: Were that the case there would be no problem.
Sorry I should be more clear about the question. I did intend to do modification of resources in the run time. I'll go with application support route. Thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.