Icloud: Allow picking subdirectories as vaults on mobile

Use case or problem

I have multiple vaults, one for each of my projects. I categorize vaults by placing them in folders, like this example file hierarchy:

- Apps/
  - Project A/
    - .obsidian/
  - Project B/
    - .obsidian/
  - etc/
    - .obsidian/
- Repositories/
  - Project F/
    - .obsidian/
  - etc/
    - .obsidian/
- Miscellaneous/
  - etc/
    - .obsidian/

I use iCloud to sync my vaults between mobile and desktop, which is all well and good until I try to access a vault from the mobile app. Only the top level folders that I use for organization are displayed. When I tap one, wanting to access the directory’s (the vaults), Obsidian loads the directory itself as a vault, and creates .obsidian in that “grouping” directory. It also loads the plugins and files from each of those vaults, causing the app to be unusable for a while (2+ minutes in my case) due to loading the workspace and indexing.

For example, the app will display Apps, Repositories, and Miscellaneous from the above hierarchy. Tapping Apps will then:

  • Create Apps/.obsidian/
  • Open Project A, Project B, and etc as folders inside the new Apps vault instead of their own vaults.

Proposed solution

When creating a vault, Obsidian creates .obsidian in the main vault directory. Therefore, if .obsidian isn’t there, a directory should not be treated as a vault, and instead be displayed as a foldout menu. When displaying vaults to open, a search should begin at the sync directory root and continue recursively until a directory containing .obsidian is found, at which point the directory is considered a vault and is displayed in the list.

Some pseudo-code as an implementation example:

func loadVaultsRecursive(from file) -> [URL] {
  if (file.type != .folder) {
    return []
  }

  if (file.contents.contains(".obsidian")) {
    return [file]
  } else {
    return file.contents.flatMap(loadVaultsRecursive)
  }
}

let validVaults = loadVaultsRecursive(from: syncDirectory)

Are all these vaults nested under one larger vault?

No they are not. Opening one of the top level folders seems to create a vault.

This is an icloud specific limitation, we only consider top level directories as vault candidates.
With obsidian sync you can pick whichever vault you want.

Oh, is this a bug? Any ideas on if there’s a timeline for a fix?

It’s not a bug. Specifically on iCloud we only consider top level directly of the obsidian folder. I renamed this feature request for clarity