Quick Action can't write to Dropbox folder

I have a Quick Action that runs a shell script to convert a file from chordpro text to a PDF using ChordPro.

It works fine on files on my desktop, but when I run it on files in my Dropbox folder (which is in the new ‘cloud library’ location) it can’t write the new PDF file.

I’ve given Automator ‘full disk access’ in system settings. What else do I need to do to give this Quick Action write access?

This reminds me of a nuisance I found. I happen to store my bookmarks not in the browser but as .webloc files on a regular folder structure. Any mac-assed browser will allow you to drag the URL to a desktop folder and generate a .webloc file.

But it turns out that if the folder is one of the “iCloud app folders” created for example by Obsidian or Notebooks that live on your iCloud Drive root folder, it won’t work. You have to drag the URL to the desktop and then use the Finder to drag to that location. But it works as expected if the target folder it is a regular folder created by myself in iCloud Drive.

I guess you are in the same situation because Dropbox is now one of those “cloud library locations”. I did not find a way to overcome this.

I think I’ve fixed it…

Reading this thread on the DropBox forum suggested changing to the directory in the script to get around the permission issues.

So I inserted lines 4 & 6 into the script, and it now seems to work.

export PATH=/usr/local/bin:$PATH
for f in "$@"
	dir=$(dirname "$f")
	name=$(echo "$f" | cut -f 1 -d '.')
	cd $dir
	chordpro "$f" -o="$name".pdf