How did PortableApps implement relative paths?

One of the things that impressed me about the PortableApps implementation is how they made Gramps so much more agnostic about locations of the User Directory & Media objects.

Whenever a USB device is plugged into a new system, it is assigned an arbitrary drive letter. But PortableGramps detects its own location upon launch and revises the relative offsets. Then triggers Gramps. And Gramps registers the correct .ini files, plugins, relative media path, database path, and so forth.

And if the installation is dragged to a hard drive, it detects that and adapts transparently.

Oh, the PortableApps implementation isn’t utterly agnostic on Windows… it is only 32bit. (See their 64bit policy.)

Is this something that could (or should) be adapted to the core of Gramps?

It would be lovely if some future version of Gramps could be told the User Directory is at a different location (say an external drive that had been pulled from a system where the OS had been crashed) and Gramps would adapt to register the add-ons, finding the .ini files & trees with their Media objects. Thus allowing at-risk research to be easily recovered via a full backup.

Obviously, there would be some tricky issues to resolve. Like: what what happens with dependencies like GraphViz; how to resolve Media objects with absolute paths on secondary partitions.

The absolute paths might have already been addressed elsewhere. (I don’t use Media objects because I’d rather invest that indexing effort in a Document Management System.) If a Linux user restores a full backup from a Windows user, does the restore also resolve the absolute paths for Media objects those weren’t on the Windows OS partition?

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

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.