BUG ID # 3519134: AppleScript problem with files on "non-mounted" volumes
BUG ID # 3519134: AppleScript problem with files on "non-mounted" volumes
- Subject: BUG ID # 3519134: AppleScript problem with files on "non-mounted" volumes
- From: Mark Douma <email@hidden>
- Date: Wed, 21 Jan 2004 16:28:38 -0500
First of all, I'm rather new to these lists, but I've noticed that
there are some Apple people that appear from time to time, so I thought
I'd mention this bug I've run into for what it's worth.
Second, I'm not sure whether we can send rich text format messages to
this mailing list, so to be safe I'm sending it as plain text. For me,
at least, it's much easier to make sense of stuff when it's in color
and formatted half-way decent. In that case, you can find a color
version of this message at
http://homepage.mac.com/mdouma46/panther/bugs.html
BUG ID # 3519134: AppleScript problem with files on "non-mounted"
volumes.
SUMMARY:
I know of two instances (in Mac OS X 10.3.x) that cause AppleScript
errors when trying to use files (either by dropping those files onto a
droplet, or prompting for them through an open file dialog) that are
located on "non-mounted" volumes. By "non-mounted volumes", I'm
referring to volumes that do not normally appear, for instance, in the
left-most column of a Finder window set to column view. Another way of
expressing this would be to say that all "mounted" volumes are those
volumes for which a "mountpoint" exists in the /Volumes/ directory. The
first instance is with files that are located on a networked volume
that you connect to through the Finder's "Network browser" method, and
the second instance is with files within your user or "home" folder
when you have FileVault enabled.
STEPS TO REPRODUCE:
Regarding the first instance:
I have my G4 machine running OS X 10.3.x networked to a Power Macintosh
7600 running OS 9.1. File Sharing through TCP/IP is enabled on both
machines. The name of the 7600 is "PM7600" and the name of the hard
drive on the 7600 (or in other words, the volume I'm sharing) is
"Macintosh HD". I connect to the 7600 using the "Network" folder in a
Finder window. First I select the Network folder, then click on the
"PM7600" server icon, click connect, enter my name and password, and
connect. I then select the "Macintosh HD" volume, then the "Desktop
Folder", and then the example file I'll be using, "Geneva". So, in a
Finder window in column view, the path to this file looks like
"Network/PM7600/Macintosh HD/Desktop Folder/Geneva".
If I check the Finder's Get Info window, however, I'll find that the
actual path to this file is shown as:
"Mac HD_OSX:private:var:automount:Network:PM7600:Macintosh HD:Desktop
Folder:Geneva"
Now, I take this file and drag it onto an applescript droplet that
contains the following applescript code:
on open files_
repeat with file_ in files_
tell application "Finder"
set filename_extension_ to name extension of file_
display dialog "The filename extention of this file is " &
filename_extension_
end tell
end repeat
end open
Dragging that "Geneva" file onto this droplet will result in the
following AppleScript error message:
"Can't get <<class nmxt>> of alias "Macintosh HD:Desktop Folder:Geneva"
If you look carefully, you'll notice that the path to the "Geneva" file
is shown as "Macintosh HD:Desktop Folder:Geneva" rather than the actual
path of "Mac HD_OSX:private:var:automount:Network:PM7600:Macintosh
HD:Desktop Folder:Geneva" as shown in the Finder's Get Info window.
Another way for me to confirm this same behavior would be to run the
following script in Script Editor:
POSIX file "/private/var/automount/Network/PM7600/Macintosh HD/Desktop
Folder/Geneva"
The result is:
file "Macintosh HD:Desktop Folder:Geneva"
In other words, AppleScript is (incorrectly) treating a file which I've
selected through Panther's "Network Browser" method as if I had used
the "Connect to Server" dialog box to actually mount the "Macintosh HD"
volume of the networked computer, PM7600, alongside my other local
volumes.
The reason for this, I think, is that as AppleScript works its way up
the directory tree from the "Geneva" file,
("/private/var/automount/Network/PM7600/Macintosh HD/Desktop
Folder/Geneva") it encounters "Macintosh HD",
("/private/var/automount/Network/PM7600/Macintosh HD/Desktop
Folder/Geneva"), which is a symbolic link/mountpoint created by the OS
X automount daemon. It resolves this symbolic link to the "original" it
points to, which is "mdouma46:Macintosh HD", or, in other words, the
"Macintosh HD" volume mounted alongside my other volumes ("mdouma46" is
my computer's name).
The only thing is, I _haven't_ mounted "Macintosh HD" alongside my
other volumes, so trying to process this "Geneva" file in this manner
will result in an AppleScript error. (If I had mounted "Macintosh HD",
there would be a "Macintosh HD" mount point inside the /Volumes/
folder, which there isn't).
Regarding the second instance:
As I mentioned earlier, the second instance of this behavior is with
files within your user or "home" folder when you have FileVault
enabled. Having FileVault enabled results in a similar situation to the
first instance, since FileVault uses a sparse disk image to hold the
contents of your user folder, and the volume that this disk image
represents is accessed in a "non-mounted" fashion. What I mean by this
is that although the volume is mounted in the sense that its files can
be accessed, it does not appear in the left-most column of a Finder
window set to column view, nor is there a mountpoint in the /Volumes/
folder. So if my username were "markdouma", my example file were
"Geneva", located on my Desktop, and I dropped that file onto the same
droplet mentioned above, I would get the following AppleScript error
message:
"Can't get <<class nmxt>> of alias "markdouma:Desktop:Geneva"
EXPECTED RESULTS:
When dropping the example files on the example AppleScript droplet, I
expected the droplet to succeed, presenting me with a dialog that
showed the filename extension of the files dropped onto it. It succeeds
with all files that do not meet the situations described above. (For
example, if I have FileVault disabled, and try the script with a file
that resides on my /Desktop/ folder, the script succeeds just fine).
ACTUAL RESULTS:
Instead of the droplet succeeding, it fails because the path(s) to the
file(s) are being handled incorrectly.
WORKAROUND:
For the first instance, a workaround is to connect to the server and
mount the volume using the Finder's "Connect to Server:" dialog box,
avoiding all use of the "Network browser" method. There is no true
workaround for the second instance. Possible options include turning
FileVault off, or moving the files to a different location outside of
your user folder and then running the script.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.