Please bear with me, as I have been racking my brain on this. This is my last time before I give up and just cheat somewhere in my script. Ok, here goes:
If you have a firewire drive mounted, it creates an alias in /Volumes.
If you have an applescript that gets the contents of the folder /Volumes, it will list that alias, naturally.
If your startup disk has the same name as the FW drive, and your applescript uses the name of that FW alias, it will point to your startup disk, not the FW drive.
If you rename your startup disk, the alias again will point to the FW drive.
Applescript behaves this way because, when applescript returns the contents of /Volumes as text, the text can’t tell, later in the script, that there is a difference between one drive or another, even though they are in different locations, UNIX-wise.
Also, doing shell script “ls /Volumes” will also return the name as text, creating the same conflict.
Part of the problem is, the Finder shows all volumes in that weird directory “above” the hard drive (the one with the “computer name”), showing hard drive, mounted FW drives, and “Network”. This is not really the location of this stuff, on the UNIX level, but applescript is going by what the Finder sees.
So, in an applescript that can see the alias to the FW drive, it points to the startup drive if they have the same name because since 10.2, aliases try to resolve paths first, ID’s second, and because the name is the same as the alias, it resolves to the first path, in this case, the startup drive.
I know I could simply rename one of the drives, but for my project, I can’t really do that as I am setting up computers out of the box, and don’t want to rename people’s drives.
The only thing I can think of, is before the applescript runs, to rename startup disk temportarily, running the applescript, then naming it back. I can’t figure out how to rename the startup disk though, within an applescript.
I have seen other programs (like Bombich’s NetRestore and CCC) that exclude the startup disk from it’s routines, even if 2 disks have the same name. Not sure how he did this, but it could have something to do with “Alias Manager” and changing the way an alias resolves it’s original, by searching for ID first, path second.
Why, oh why, is it an alias in /Volumes and not the actual mount point? Where is the actual mount point for the firewire drive? When you do a show original on the alias, it shows the drive in that silly “My computer” directory (along with the startup disk and Network). So, in essence, according to the Finder, the hard drive is contained in a folder within itself. Very disturbing.
If anyone has any info on why this is like this, please share what you know. I can’t find much on apple developer. I think it’s simply something that is not possible using applescript.
ciao