macedotavares / obsidian-utilities

An Alfred workflow focusing on quick entry and logging.
https://github.com/macedotavares/obsidian-utilities
GNU General Public License v3.0
169 stars 7 forks source link

Workflow does not support iCloud vault path #10

Closed KingOfSpades closed 3 years ago

KingOfSpades commented 3 years ago

Hey,

Not sure this is something that can be fixed. I think it's on the Apple side of things or it is my own doing. Lemme explain :)

I'm using iCloud to sync/store my Obsidian vault. To make things easy for me I created a Synlink to the vault in my personal folder. This looks like:

/Users/name/ZETTL/ZETTLKST -> /Users/name/Library/Mobile Documents/com~apple~CloudDocs/ZETTL/ZETTLKST

Obsidian also sees the vault @ /Users/name/ZETTL/ . Now when I use Obsidian utilities and set the vault path to /Users/name/ZETTL/ZETTLKST and use the search function I get the iCloud folder link as results:

Screenshot 2021-01-20 at 09 30 48

This wil in turn throw an error when I try to open the file:

Screenshot 2021-01-20 at 09 33 32

macedotavares commented 3 years ago

That's weird. The error message shows that the workflow correctly retrieved the file's URL. Have you tried setting vault_path to /Users/name/Library/Mobile Documents/com~apple~CloudDocs/ZETTL/ZETTLKST? Would that even be an acceptable workaround?

KingOfSpades commented 3 years ago

Forgot to include that. It would be a acceptable workaround but changing the vault_path to Users/name/Library/Mobile Documents/com~apple~CloudDocs/ZETTL/ZETTLKS seems to break the search:

Screenshot 2021-01-20 at 11 10 23 Screenshot 2021-01-20 at 11 10 27

macedotavares commented 3 years ago

You have to include the slash at the beginning. /Users/name/Library/Mobile Documents/com~apple~CloudDocs/ZETTL/ZETTLKS

If that still doesn't work, please activate the debugging mode in the upper right corner of the workflow window, try running the action again and send me a (redacted) copy of the logs.

KingOfSpades commented 3 years ago

Ow, that was a typo. The / was included. It yields no results. Debugging info is:

[10:44:44.899] Obsidian Utilities[Script Filter] Queuing argument 't'
[10:44:45.175] Obsidian Utilities[Script Filter] Script with argv 't' finished
[10:44:45.179] Obsidian Utilities[Script Filter] {"items":[{},{"type":"file","title":"","subtitle":"","arg":""}]}
[10:44:45.183] Obsidian Utilities[Script Filter] Queuing argument 'te'
[10:44:45.429] Obsidian Utilities[Script Filter] Script with argv 'te' finished
[10:44:45.432] Obsidian Utilities[Script Filter] {"items":[{},{"type":"file","title":"","subtitle":"","arg":""}]}
[10:44:45.434] Obsidian Utilities[Script Filter] Queuing argument 'tes'
[10:44:45.506] Obsidian Utilities[Script Filter] Queuing argument 'test'
[10:44:45.687] Obsidian Utilities[Script Filter] Script with argv 'tes' finished
[10:44:45.691] Obsidian Utilities[Script Filter] {"items":[{},{"type":"file","title":"","subtitle":"","arg":""}]}
[10:44:45.937] Obsidian Utilities[Script Filter] Script with argv 'test' finished
[10:44:45.941] Obsidian Utilities[Script Filter] {"items":[{},{"type":"file","title":"","subtitle":"","arg":""}]}

I think this is just a limitation of the iCloud file system :/

macedotavares commented 3 years ago

OK. Let's check another thing. Maybe those tildes in your vault path are the culprits.

Please edit the script filter and replace the first 3 lines with the following:

originalpath="$vault_path"
expanded="${originalpath/#\~/$HOME}"

Let me know if that solves it.