Why don't relative folder paths work for media?

Today I had to update my old RM7 file with a bunch of family facts. I’d had my RM7 file created on Windows, today I am on Mac. As you might expect, the file needed a conversion. But the conversion left the media links all broken.

In the first place, it is weird to me that the program can’t figure out by itself that the media links (starting with D:/ Documents/) are broken, and automatically suggest to the user that it can run fix for them. “Would you like the links to be fixed?” Instead, user needs to google and discover there is Link fix tool available in the app, but buried in the settings.

But most importantly, as a web developer, I don’t really understand the whole logic flow in resolving paths (esp. media links) in the application.

I would expect that RootsMagic could consume relative paths for media (and other) folders so that the links work no matter the volume the file is run from. If the path starts with ‘.’ (as in ‘./media’) then the relative path should be resolved. This is how things are done, for example in TypeScript imports.

So I have each instance of a media with absolute path D:/Documents/...., we also have Folder Settings > Media folder, but we also have media link fixer. Hw do they relate to each other, which takes precedence over which? Is there any diagram available

I’d expect that selecting a new Folder settings > Media folder will trigger media rescan and relink of whatever can be found and relinked.

This is total mess and there doesn’t seem to any sane way of managing the links should you need to move the file and assets around and run them from various locations. It’d be sufficient if user could enter ‘./media’ or './media/` as a relative folder path and have the app automatically re-establish the linkage.

Can some logic and UX testing be brought into this product?
As my tree grows, I feel this program to be just inefficient and on the brink of leaving my database unmanageable.

Relative paths do work in RM starting with RM8. I’m puzzled about your reference to RM7 because you are on a Mac and RM7 doesn’t work on a Mac.

Despite the fact that relative paths work in RM starting with RM8, in my opinion the way they work is not totally straightforward. Before we get into a discussion of how RM8 and RM9 support relative paths, could we clarify your exact environment. Which version of RM are you presently running, and are you running on Windows or a a Mac?

Jerry;

  1. RM7 did run on macs with a codeweaver wrapper up to OS Mojave but not later.
  2. Rootsmagic does an excellent job of relinking media files once you tell it where to start. FTM is horrible at this and requires 2 manual clicks per media item if you ever rename or move the master folder. A thousand media items = 2000+ clicks. This is one of FTM’s worst features.

I didn’t say I was using RM7, I only said my file was RM7. I’m on macOS 14.4.1, RM 9.1.4.0.

So here’s the story on how media file paths worked in RM7 and how they work in RM9.

In both RM7 and RM9, there are two database fields for each media file - a media path and a media filename. Let’s take a real example from my RM7 database. I’m a Windows user, so my filepaths reflect Windows naming conventions.

filepath: C:\Users\jbryan\Dropbox\rm_media\deathcertificates\
filename: peters_alva_edward_death_certificate.jpg

The part of the filepath about C:\Users\jbryan\Dropbox\rm_media\ is the same for all my files and is repeated for each file. Then there are a bunch of subfolders such as \deathcertificates\ and \marriagerecords\ etc. The part of the filepath about C:\Users\jbryan\Dropbox\rm_media\ is repeated for every media file and the part of the filepath about C:\Users\jbryan\Dropbox\rm_media\deathcertificates\ is repeated for every death certificate, etc.

For the same file in my RM9 database, we have the following.

filepath: ~\deathcertificates\
filename: peters_alva_edward_death_certificate.jpg

This is where the filepath is relative. The ~\ in the filepath becomes replaced by the value in Settings => Folder Settings => Media Folder which I have set to C:\Users\jbryan\Dropbox\rm_media

However, you can’t really see any of the relative support stuff in the RM9 user interface. The media support in the RM9 user interface looks exactly like the media support in the RM7 user interface and the ~\ in the filepath is handled behind the scenes. You can never see it.

However, you can see the effects of the ~\ in the filepath. For example, if you simply change the value of Settings => Folder Settings => Media Folder and change nothing else, then all of your media links will usually be broken because the ~\ in all your filepaths will be mapped to the new value of Settings => Folder Settings => Media Folder. So you should change the value of Settings => Folder Settings => Media Folder only if you move the location of your main media folder and you should change both at the same time. This is something you must do manually and and from outside of RM. Making the change of both Settings => Folder Settings => Media Folder and of the actual location of your files is not something that RM does for you. But after you make the changes, then RM follows all the media links just fine. None of the media links are broken and you don’t have to run the Fix All Broken Media Links tool.

That’s about half the story. This is message is so long, let me put the other half in a separate message.

2 Likes

Here’s the other half of the story. RM7 also had a setting that was somewhat equivalent to the Settings => Folder Settings => Media Folder setting in RM9. However, in RM7 the only thing the setting did was to establish the first place RM7 went to look when you were linking a new media file into RM. The file might or might not actually be there, and in any case you could and often did navigate to the media file to be added just as you would with any File => Open type of operation. And no matter what, RM7 always stored the full filepath for each media file even if all the media files were in the same media folder.

It remains the case in RM9 that in addition to setting the value to which the relative link ~\ is mapped, Settings => Folder Settings => Media Folder is also the folder where RM9 starts looking for a new media file that you are linking into RM. But what if the new media file you are linking into RM9 isn’t in the relative folder? Well, it works anyway. RM9 will do one of two things.

  • If the file is in your My Documents folder, then RM9 uses ?\ as a code for a relative path to your My Documents folder.
  • If the file is not in your My Documents folder, then RM9 uses the full filepath all the way back to the drive letter, exactly the same way that RM7 did it.

I don’t know what the Mac equivalent of the My Documents folder is. But even on Windows, the concept of the My Documents folder has become somewhat slippery. Software such as Dropbox and OneDrive and Google Drive will sometimes map the concept of a My Documents folder to a different folder that the software itself manages and which is synced to cloud. RM9 seems to follow the concept of a My Documents folder to wherever the My Documents folder is really located and to however it is really named.

Finally, files downloaded from Ancestry by RM’s TreeShare feature are handled in their own unique way. Suppose your RM9 database is called MyGenealogy. Then TreeShare creates a new folder called MyGenealogy_media and places all the media files it downloads into that folder. In this case, RM9 uses a relative file path of *\ to indicate that the file is stored in the special MyGenealogy_media folder (or whatever the file name is for your RM9 database).

It remains the case that these relative file paths in RM9 are completely hidden from the RM9 user interface. But if you know the relative file paths are there and how to use them, it can make using media files much easier. I have given one example already. Namely, if you move your media file folder for RM9 and change Settings => Folder Settings => Media Folder to match, then you are done with adjusting your media folders and there are no broken links. Another example is that you might be using RM9 on two different computers and if the media files are on a different location on the two computers, you can set the Settings => Folder Settings => Media Folder differently for both computer and there will not be any broken media links on either computer.

path saved in database is absolute OR relative if the path is in one of these location:

‘?’ media folder as set in RM preferences
‘~’ home directory (%USERPROFILE%)
‘*’ RM database file folder location

These all have MacOS filesystem equivalents.

2 Likes

@thejerrybryan First of all, I (we) owe you a big thank you for taking the time to explain it all. I believe this should be part of online help.

I have played with these special path fragments that @RichardOtter kindly listed (?, ~, *) to see if I would be able to rectify the situation. And the results were as follows:

(I keep all my assets in one shared media directory next to the .rmtree file).

Round 1:
I set the Settings > Media folder using the macOS select folder dialog. The path was expanded to an absolute one, as in /Users/<user>/..../media

  • prefixing the file name with ?/<my_file.jpg> was expanded to full absolute path: /Users/<user>/.../media/<my_file.jpg>
  • same with prefixing with */media

The file got properly relinked.

Round 2:
I set the Settings > Media folder by entering */media - which should be understood as a directory named media living next to the .rmtree file. The path was not expanded to an absolute one.

  • prefixing the file name with ?/<my_file.jpg> was expanded to full absolute path: */media/<my_file.jpg> and the file remained broken

Myself, I would prefer that the */media expression set in Settings were honored as relative one, and then ?/my_file.jpg was properly resolved (resolved internally, but not: expanded in the UI!) and the file was found.

The goal of these experiments was just to understand the synopsis here, but I am not going to iterate over all my media assets and change their paths manually, oh no :slight_smile:

Therefore, all in all, I chose to use the Fixing tool. Its outcome was successful in that it managed to fix 99% of my assets paths, but it was dissatisfying in that the fixed paths are actually absolute ones, back again. Meaning: I will have to run this fixer every time I happen to open the database on a different computer. If this is correct, then this is an awful way of handling media.

Of all small and big misfortunate design decisions in RM9 that I have noticed so far, I find this one the most horrible and “unscalable”. I would see a user setting that allows user to prefer relative paths throughout the whole database, and selecting a media folder in Settings, would then be kept relative (if the directory has a common parent with the .rmtree, and absolute otherwise.

The way I think of it is that RM8 (and now RM9) implemented relative file paths for media files and then hid the new feature from the users. As far as I know, the feature is not documented in any way. That makes it very difficult for a user whose computing environment could benefit from RM’s new relative path feature to take advantage of the feature. For example, a user who runs RM on multiple computers could surely benefit by using the feature.

I have wondered if a better design might have been for the RM user interface to display the relative codes as they really are in the RM database rather than displaying the names of the associated folder. Namely, what if the codes were displayed simply as ~ or as ? or as *, while at the same time providing documentation of what the codes mean.

1 Like

I never tried entering one of the anchors from the RM UI on Windows. All three anchor characters are illegal in file names.(I don’t know if it’s at the Win32 or NTFS level).

Even though the database saves paths as relative, they are always shown as absolute in the UI.

A related issue is how RM decides which relative path anchor to use when a file is added.
Since all of my files are in the media folder and all of the file paths in the database start with ‘?’, I’ll guess that the media folder has highest precedence. My media folder is also in my home dir and in the same folder as the database file.

Not only can you not see the anchors, you can’t enter them. That’s not the way it works. RM enters them for you behind the scenes and you can’t see them. And as you say, the presentation in the UI shows absolute paths by converting the relative roots to absolute paths.

As far as priority, from observing the RM behavior it appears that the RM media folder is first priority, the logical “my documents” folder is second priority, and the root of the disk is third priority. Relative paths for media downloaded from Ancestry via TreeShare are not a part of this priority scheme. Their root is always a folder called dbname_media when your RM database is called dbname. None of this is under user control.

the RM media folder is first priority,
the logical “my documents” folder is second priority,
I think you mean home folder - Usually c:\Users\MyName

and the root of the disk is third priority
I think you mean the folder that contains the database file that is open.

The root of the drive is an absolute path. That’s last priority.

NOTE I haven’t checked this in a couple of years. Maybe it’s changed.

OK, I understand the status quo, but as an end-user I don’t like it, specially this two-layer paradigm: UI + what’s under the hood (where the anchors are expanded and always resulting in absolute paths).
Why not have ECMAScript-like relative paths starting with ./ (and possibly also ../ - for parent directories, although probably not much needed) - paths that will never be expanded but instead remain relative both in UI and under the hood?

1 Like

You may be interested in my external files utility.
It helps in managing external files.
See: https://richardotter.github.io
Look for-
RootsMagic Media Files Helper Utility: “TestExternalFiles”

I have read this thread and understand the concept on a very basic level.

I keep all of my media files in one folder called “media”. This folder resides in my My Documents folder (I’m using Windows 11 and RM 9). I looked at the Settings => Folder Settings => Media Folder in RM 9 and see that the media folder information is blank and I am given the opportunity to select a media folder. I didn’t do anything, since the database that I am using doesn’t have any issues finding my media folder. I understand from the thread that the current location of my media folder is being hidden from my view.

I will be splitting off a portion of my database for a relative. I will be sending her a backup of that database segment along with the media associated with that database. Should I tell her to keep the media folder within the My Documents folder and everything will work fine (she will be using either RM 9 or 10)?

Since you are going to send a backup file containing media, it really doesn’t matter how you are storing media on your own computer. When your relative restores the backup you send her, the restore process will place all media files in a single folder and will essentially point all the file links to that folder. There are details behind the scenes about why that will “just work”, but it will. In fact, the same thing would happen if you had kept your media files in all kinds of different folders. When your relative restored the backup you send her, the restore would not reconstruct your folder structure on her computer. It would still just put all the media files into a single folder and it would set the media links all to that folder.

1 Like