I’m trying to create a new vault programmatically without using the built-in vault management system.
On Linux I have been able to do this by adding a new entry to the file:
As well as creating a
JSON file for the new vault which contains the following:
This filename is a random string of numbers, same as the new vault entry added to
The cache does not update itself so it will not allow me to open this brand new vault until I have either;
- Closed an already open vault, which triggers a cache/state update
- Opened an already created vault which has it’s path already cached, triggering a new cache/state update
I believe what is interfearing with this is these
.config/obsidian/SingletonSocket .config/obsidian/SingletonLock .config/obsidian/SingletonCookie
Doing some testing, I deleted these and then tried to open a new vault, while already having an older vault open.
It worked as in it opened the new vault I requested rather than giving me an error “this vault could not be found” but the database has been “corrupted” after deleting those files, and it just sits on the loading screen.
That’s my experience and I just need some ideas on how to restart these Singleton files or Obsidian itself to update the cache/state manually.
I realize this is a very niche use case and that I’ve hacked this in ways it’s not meant to be used, but I’m just curious about problem solving it. It’s not a huge deal for me to just manually close all the vaults to ensure the new vault gets loaded, but a better solution would be appreciated.