Thanks for the direction.
It looks like GEDCOM7 file paths works in a similar manner. Except that they store a default base directory path in the Header and explicitly use the RELA
tag again to state that the object’s path (which, unlike Absolute paths, does not start with a slash directory separator) is relative to the same base directory.
0 HEAD
1 GEDC
2 VERS 7.0
1 FILE-REF
2 RELA /Users/username/Documents/Genealogy
0 @M1@ OBJE
1 FILE Photos/Family/reunion2023.jpg
2 RELA /Users/username/Documents/Genealogy
1 FORM jpg
1 TITL Family Reunion 2023
0 TRLR
This SuperTool script (a "SuperTool Script" type Note in .gramps XML format) can be pasted into the [**Import Text** add-on gramplet](https://gramps-project.org/wiki/index.php/Addon:ImportGramplet). Pressing the Import button creates the Note.
Then switch categories to Media and use the SuperTool addon tool to import the the script from the Note (File
→ Load from Note
). Select some Media object and use the Execute button to show which which use Absolute or Relative paths.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE database PUBLIC "-//Gramps//DTD Gramps XML 1.7.1//EN"
"http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
<database xmlns="http://gramps-project.org/xml/1.7.1/">
<header>
<created date="2024-07-05" version="5.2.1"/>
</header>
<notes>
<note handle="_fa5315d935a39708c614075dc67" change="1720219116" id="N0012" type="SuperTool Script">
<text>[Gramps SuperTool script file]
version=1
[title]
Media paths
[description]
Determine if selected Media objects have a Relative path or an Absolute one
See Discussion
https://gramps.discourse.group/t/how-are-relative-vs-absolute-paths-marked/5707
https://github.com/Taapeli/isotammi-addons/issues/33#issuecomment-2212313859
[category]
Media
[initial_statements]
from gramps.gen.utils.file import media_path_full, media_path
relative_path = media_path(db)
[statements]
absolute_path = media_path_full (db, path )
object_path = path
compare_path = "Relative path: " + relative_path
if absolute_path == object_path : compare_path = "Absolute path"
[filter]
[expressions]
object_path, compare_path
[scope]
selected
[unwind_lists]
True
[commit_changes]
False
[summary_only]
False
</text>
</note>
</notes>
</database>