Vault root folder's relative .path gives /

Take the following example vault folder tree:

  • MyVaultFolder ← The root of the vault
    • Subfolder1
    • Subfolder2
      • NestedSubfolder

If I get one of these folders as a TFolder object, I can then read its .path property, which should give a path to the folder, relative from the vault’s root directory (= MyVaultFolder).

Normally, for a subfolder, .path returns a value that could be expected. For example, for NestedSubfolder .path gives: Subfolder2/NestedSubfolder. This is correct.

But if you have the vault’s root folder as a TFolder object, .path gives this: /. On Linux and Mac, that’s a reference to filesystem root, which is totally different than the vault’s root directory. It’s not a relative path anymore, it’s an absolute path. I do understand that for the root folder, .path cannot give the folder’s actual name, but I think that instead of a /, .path should give a .

(In case you want to know background information, I am covering this problem in my Shell commands plugin’s issue tracker in GitHub, but I don’t know if it can bring anymore light into this question, so I don’t expect you to read it. If you need more information, just ask here.)

Thank you for your support!

Obsidian version: 0.12.15
Platform: Windows 10, also tested on Linux (Ubuntu 20.04)

1 Like