Org-roam-directory trailing slash or no?

Very minor thing…

In most places I’ve read, including the project’s README, the example configuration for org-roam-directory use a trailing slash (e.g. (setq org-roam-directory "/path/to/org-files/"))

This is what I’ve been doing and it works fine. However, while moving things around and looking at the database, I noticed the paths stored in the db include a double slash between the directory and files, like "/Users/jbaty/Dropbox/notes/org//"

I found this off-putting, so I changed my config to (setq org-roam-directory "~/Dropbox/notes/org"), deleted the db and rebuilt the cache. Now the links all look better (single slashes) to me and everything seems to work fine.

I don’t believe having double slashes matters, but I’m curious if the examples and resulting double slashes are intentional or if I’m risking breakage by not using a trailing slash in my config.

I now see that the docs show the setting without a trailing slash: (setq org-roam-directory "~/org-roam")

I’ll go with that!

Actually the choice of whether it has a trailing slash or not should not matter. The behaviour you’re seeing looks like a result of the new methods fo listing files: using find and rg. What operating system are you on, and what’s the output of: (org-roam--list-files-find (executable-find "find") org-roam-directory)?

On my system (NixOS), this returns me paths with single slashes, regardless of whether my directory has a trailing slash or not. Perhaps this is an issue on Windows and on Mac.

Right, I didn’t notice any actual problems when using a trailing slash for org-roam-directory, I just didn’t like that paths were stored using the double slash.

With org-roam-directory set to ~/Dropbox/notes/org/, (org-roam--list-files-find (executable-find "find") org-roam-directory) returns this…

"/Users/jbaty/Dropbox/notes/org//" "/Users/jbaty/Dropbox/notes/org//" "/Users/jbaty/Dropbox/notes/org//" "/Users/jbaty/Dropbox/notes/org//Federico" "/Users/jbaty/Dropbox/notes/org//" "/Users/jbaty/Dropbox/notes/org//"...

Removing the trailing slash in the config causes the above to return paths without the double slashes.

I’m on macOS (Catalina 10.15.4), org 9.4, and emacs 26.3.

(edited to fix config example to include slash, doh!)

This should be fixed now, in

1 Like