Sharing plugin data between vaults, stumped by Override config folder

Hi everyone,

I’m writing a plugin that intends to have its settings read by the same plugin installed in other vaults. The problem is, Obsidian doesn’t appear to provide a mechanism to determine what another vault’s config folder is named:

  1. Where does Obsidian store a vault’s “Override config folder” value?
  2. Is there an API to get the Vault object of a different vault (to access its configDir)?

I consulted the How Obsidian stores data article, checked the global data folder, the Windows registry, and the local .obsidian folder (not that it would make much sense to be stored there) but I’m not seeing anything obvious and am running out of ideas.

The easiest way to share some value between vaults on the same device is

window.localStorage.setItem(key, value);

For your original question, there is an undocumented function

App.getOverrideConfigDir(appId)
1 Like

Thank you, @mnaoumov!

App.getOverrideConfigDir(appId) was the missing link. There is one unforunate snag with its behavior: It returns null to indicate a vault is using the default config dir. This means plugin authors need to include “.obsidian” as a literal for the fallback code, which I’ve noticed the ObsidianReviewBot on github doesn’t like.

As a result, I may go with your second suggestion and use localStorage.

Thanks!

1 Like

To bypass bot review check you can use workarounds like

const defaultDir = '(dot)obsidian'.replace('(dot)', '.');

Hah, yes I thought about it! Perhaps first I will submit a version that uses “.obsidian” plainly so my intent is clear. It appears the review bot has a /skip command to presumably forward the issue to a human for review

Use: https://docs.obsidian.md/Reference/TypeScript+API/Vault/configDir to get the configuration folder, no internal API’s necessary.

Hi Joe,

vault.configDir works for the active vault, however my plugin is trying to access the config folder of a different vault.

The goal is to override a vault’s display name between Obsidian instances. The plugin is in queue so I may wait to see if you have feedback regarding the current approach

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.