access a file in a volume named "home"

Viewed 88

My NAS has a shared point named "home" and is mounted in Os X (Big Sur) This applescript reveals a bug. The System want it to be "/System/Volumes/Data/home" instead of "/Volumes/home/".

For test I wrote a text file named "dummy.txt" (with "hello world" inside) and run these lines :

get POSIX file "/Volumes/home/dummy.txt" -- returns the file object as follows
--> document file "dummy.txt" of disk "home" 
-- or --> file "home:dummy.txt"
-- or --> "file:///Volumes/home/dummy.txt"

do shell script "cat" & space & quoted form of "/Volumes/home/dummy.txt"
--> "hello world"

get file "home:dummy.txt"
--> ERROR

do shell script "cat" & space & quoted form of POSIX path of "home:dummy.txt"
--> ERROR : no such file or directory

get POSIX path of "home:dummy.txt"
--> "/System/Volumes/Data/home/dummy.txt"

Is there a workaround for this ?

1 Answers

When coercing an HFS path to POSIX path the disk name home clashes with the invisible folder home on the top level of the startup disk.

To address the external volume use always the syntax

get POSIX file "/Volumes/home/dummy.txt" 

and

do shell script "cat" & space & quoted form of "/Volumes/home/dummy.txt"
Related