brianpetro / smart-connect

84 stars 9 forks source link

Vault Path can't contain dots (MacOS FileProvider issue) #47

Open jonashaefele opened 1 month ago

jonashaefele commented 1 month ago

I eventually decided to move away from Obsidian Sync because it keeps accidentally deleting files for me. I tried Dropbox (which struggles with emojis in the file names) and have now landed on Google Drive, which syncs just fine from Mac to Android (with the help of Autosyc).

Anyway, because of Apple's new FileProvider API, you can't choose where it stores the synced files any more.

So my obsidian vault is now at:

/Users/name/Library/CloudStorage/GoogleDrive-name@email.com/My Drive/Obsidian

If I add that to the SC environment path, it sets the config correctly in 'user-data/settings.json':

  "envs": {
    "Obsidian": {
      "name": "Obsidian",
      "env_path": "/Users/name/Library/CloudStorage/GoogleDrive-name@email.com/My Drive/Obsidian"
    }
  }

but then when reloading, it somehow tries to split the path string by dots . and errors out.

Using a folder alias that points /Users/name/Google Drive to /Users/name/Library/CloudStorage/GoogleDrive-name@email.com/ and trying to choose a folder accessed through that alias as the env_path leads to SC simply not saving that change. It just ignores it. (I assume the path it get's from the file picker is somehow funny?)

(I used the folder alias that Google Drive automatically created in ~ and simply renamed them to not include a .)

However, setting the path through the alias manually in config.json works just fine:

 "envs": {
    "Obsidian": {
      "name": "Obsidian",
      "env_path": "/Users/name/Google Drive/My Drive/Obsidian"
    }
  },

TL;DR:

The stack trace points to
--> src/components/envs_settings.js --> async function post_process10 -->

const env_settings_containers = frag.querySelectorAll("[data-smart-settings]");
    for (const env_settings_container of env_settings_containers) {
        const env_scope = env_settings_container.dataset.smartSettings.split(".").reduce((_scope,key)=>_scope[key], scope); // This line
        await env_scope.render_settings(env_settings_container);
    }

Screenshot attached. (my email ends in slow.works hence the works left there.)

Screenshot 2024-10-16 at 14 18 36