Reputation: 2087
I am making an app in python on mac osx which needs changes in config.cfg file. I converted the python script into myapp.app by using py2app
. I included my config.cfg file in Resources location of myapp.app through setup.py. Then, I used Packages
to install myapp.app in /Applications location by making myapp.pkg
file. But, when I opened myapp in Application location by Show Package Contents, and tried to edit the config.cfg file, a dialog box comes which says You don't own the file config.cfg and don't have permission to write it
. I am using osx 10.8.5 Mountain Lion and Xcode 4.6.1. MY config.cfg file
[FOLDER]
extensions = cfv
#############################
[KMS]
serverIP1 = 127.56.98.104
serverPort1 = 8080
serverIP2 = 172.46.84.145
serverPort2 = 8080
SSL=TRUE
Upvotes: 1
Views: 3269
Reputation: 126028
Don't store modifyable data in the app bundle; everything in that should be static, otherwire permissions will be a mess, code signing will break, etc. In general, user-modifyable files belong in the user's home folder. For a config file, the best thing to do is probably to treat it as a preference file and store it in ~/Library/Preferences. Note that the naming convention for preference files is to use your domain name in reverse order as a prefix before the app name (e.g. com.apple.Finder); if you don't own a domain name, I'd recommend using "local" as a prefix instead. Also, most files in that folder are in .plist format (e.g. com.apple.Finder.plist); your file presumably isn't, so use some more appropriate extension (.cfg would be fine).
Upvotes: 1