Identically-named disk and desktop folder

Given a mounted disk named “foo” and a folder on the Desktop also named “foo”,


tell application "Finder"
	exists folder "foo" of desktop -->True
	exists disk "foo" -->True
	class of folder "foo" of desktop --> disk
end tell

A colleague had this situation and wanted to alert the user if one or the other of these items (the disk and the folder) was missing or misnamed.

When only the disk is present, but the folder on the desktop is not, then


exists folder "foo" of desktop

still returns “true.”

We have worked around this, but I found it to be a potential source of confusion. I doubt it is a bug, but rather by design, to accommodate the “disks are on the desktop” concept. What I can’t figure out is why the mounted volume responds to the message “folder ‘foo’ of desktop.”

Hi,

you can test a mounted volume without the Finder

"foo" is in (do shell script "ls /Volumes")