globaleaks / APAF

Anonymous Python Application Framework
33 stars 15 forks source link

Make Datadir work on OSX #16

Closed hellais closed 12 years ago

hellais commented 12 years ago

Currently that datadir is not included inside of the .app for Mac OS X.

This is shown by simply moving the built .app into a different folder and running it from there:

$ /Applications/apaf.app/Contents/MacOS/apaf Traceback (most recent call last): File "/Applications/apaf.app/Contents/Resources/boot.py", line 320, in _run('run.py') File "/Applications/apaf.app/Contents/Resources/boot.py", line 317, in _run execfile(path, globals(), globals()) File "/Applications/apaf.app/Contents/Resources/run.py", line 20, in from apaf import core File "apaf/core.pyc", line 12, in File "apaf/config.pyc", line 72, in File "apaf/config.pyc", line 37, in init OSError: [Errno 20] Not a directory: '/Applications/apaf.app/Contents/Resources/lib/python2.7/site-packages.zip/apaf/config.pycAPAF/datadir/config'

mogui commented 12 years ago

This problem doesn't deals with datadir being not included (also it is not but it is easy solved) The question is that here in the config dirs are hard coded they MUST be dynamic and relative to the app !!

regarding OS X I know the right way to do it, py2app gives an environment variable in os.environ['RESOURCEPATH'] that is the full path to the app bundle from whatever place it is launched

I don't know (and can't test) how to do the same with py2exe ask me if I wasn't exhaustive :P

[EDIT] I correct myself :P not hard coded but relative to config.py script that willi be in a zipped folder inside lib ecc... in the app bundle

mmaker commented 12 years ago

That's right. Probably the only solution is to create a function which looks on /etc, then on 'RESOURCEPATH', and finally on the relative path itself. Thanks.

fpietrosanti commented 12 years ago

Can this ticket be closed?