Relative paths for media

Gramps 5.1.4 on Arch Linux and Windows.

Hi!
So, I’m working on my family tree with my… family (I know, what a surprise). And recently I have installed Gramps for my mom on her Windows machine, but I also use two computers (both Arch Linux). I use Nextcloud to sync between the computers.
Now, the issue is that while I use the relative paths for the media, when I set up the root directory for relative paths, that is saved in the database, so it won’t work when synced between multiple computers. With my laptop and desktop, I just well, manually changed it when I needed to work with it on the other computer, but I can’t really expect my mom to do the same on her Windows machine, as she is not that technical minded.

Is there any way to force Gramps to use a root directory for relative paths that’s configured outside the purview of the database?

I wonder why the relative path for media is stored in the database instead of in the gramps.ini file. Does it have something to do with the option of creating a backup that includes the media files?

Anyway, I was going to suggest that you create a separate desktop icon for your mom to use, which would launch Gramps using a command line configuration option to override that path, but I fear that might not work, if it can only override options that are in the ini file.

A few questions.

  1. If you can set the relative base media path in Gramps to Nextcloud on one computer, why can you not set it for all computers?

  2. What path do you use for the Gramps database on each computer? I assume since you are using common media files, the database itself will be common to all machines.

If you are using multiple database trees, you may want to assign each tree its own media path so the media do not mingle and and are already separated when you want to do something else with one of the trees (like delete).

I don’t know if there is a way, but it would surely be a good suggestion for improvement, because the base path is OS and user dependent.

Does your use of Nextcloud imply that you have your database in that personal cloud? If you have, please note that althoug SQLite is probably safer than BSDDB, it’s still not entirely safe, because of the nature of Gramps itself. It will probably work well between computers used by yourself, if you don’t make parallel changes, but if will probably go wrong if your mother does make changes while you’re working on the same object.

Can you tell us more about your workflow?

@ennoborg @DaveSch
thank you for help.
Well, the database is located locally on my PC, as well as the media files. NextCloud is just the sync solution I use with my mom (previously, between my own computers I used a syncing method that is p2p). So, Gramps (and everything else, really) only works with the local files, the syncing is done with the third party apps (like the Nextcloud desktop app).

OK, is that a real time sync, like MEGAsync or OneDrive? I mean does it work in the background like they do, or do you start the sync yourself?

We had a discussion about Gramps on Dropbox drives long ago, which was considered risky, even though the files are on your local drive. In those days, Gramps used BSDDB, with every table in a separate file, and sometimes things went really wrong. With SQLite the database is one big file, but I would still be careful with that.

Also, do you both make changes to the database?

I know it isn’t considered ideal. In general, yes the sync is automated in the background, and I’d guess it can be considered real time.
I set it up to back up the DB every time I close the app, so even if something goes wrong, I could restore it. We both make changes to the DB, but never at the same time (it was not an issue before as it was always me just at a different PC). I am vaguely aware of that not being a good idea. And, as I saw, gramps uses a lock file, which also gets synced. I will probably always get in touch with my mom if she wants to do any change anyways, as I said, she is not tech savy, and Gramps is a complicated software.

An other question: whenever I add a new media file, is the default behavior using the absolute path? I remember using the media tool to convert them to relative in bulk a few times before when I had some pictures not showing up properly, but I haven’t been actively adding new images for a while, just started now during the holidays, meeting my mom.

There’s a checkbox in the media file selector, to use relative paths, and in my experience its value is remembered, so once set, it will also be set next time.

Have you tried making the Base Media path as simple as possible? As a default, each machine’s OS has pointed you to create the folder somewhere in the user’s folder structure. It is the user folder structure that is causing the issue.

c:\Genealogy-Media

For your mother, you can make a Quick Link of the media folder in her File Manager so she does not have to hunt for it if she needs access to the raw files.

@TarsolyGer you can even go further than @DaveSch advised here, by completely eliminating the base path. If you do that, all relative paths start at the user’s home folder, and there is no OS dependent data stored inside the database anymore.

What I mean is, that when you use a path like

/home/enno/Documents/Archive

on Linux, you will also need a path like

C:\users\enno\Documents\Archive

on Windows.

If you include the Documents/Archive part in the individual media paths however, and empty the base path, Gramps will still find the media on Linux and Windows, because it automatically adds the user’s home path, when the base path is empty.

And maybe even that home path can be changed with an environment variable, in case you have your mother’s My Documents (with the internal name Documents) on drive D.

Any my guess is, that you can make this change on Linux by letting Gramps change all relative paths to absolute, then empty the base path, and change all paths to relative again. But that is something that I haven’t really tried myself, so you’ll have to experiment a bit, and use backups where needed.

The underlying assumption here is, that on both Linux and Windows, you actually have a Documents folder with that exact name. But even if you don’t, you can also use a folder with a different name, like gramps-media, as long as it sits in the user’s home folder.