How did PortableApps implement relative paths?

I was able to modify the bundled Mac version and launch it from a USB stick.

After installing the bundled version from the .dmg file, I made a copy of Gramps.app and gave it a different name. Then, within the new copy, I edited Contents/Resources/gramps_launcher.py and changed the APPDATA environment variable to point within the bundle instead of the usual location:

# environ[‘APPDATA’] = join(environ[‘HOME’], ‘Library’, ‘Application Support’)
environ[‘APPDATA’] = join (bundle_lib, PYVER, ‘site-packages’, ‘gramps’)

(That’s the same location that was already being used for GRAMPDIR.)

Then I copied the new version onto a USB stick and launched it from there. It was much slower, of course.

Maybe another possibility is to launch Gramps from the command line and override the APPDATA setting (although that variable is not listed here), and then create a desktop icon to launch it that way, but I don’t know if that can be done.

1 Like