set defaultFolder to non-existent folder behavior

Emilio Gagliardi emilio at ualberta.ca
Fri Jun 24 14:45:43 EDT 2005


Hi all, here is an interesting one I thought I'd pass along to see if  
anyone has encountered this before.

In the documentation for defaultFolder it says that if you set the  
defaultFolder to a folder that can't be opened it returns "can't open  
directory".  So i have some code that mounts a volume from a  
networked computer to move some files across the network.  I created  
a function to check if the network computer is, in fact, mounted.   
The function works correctly when the drive is mounted in that result 
() is empty.  Now, to test my code, I unmounted the volume through  
the Finder(eject) and disconnected the network cable from the  
computer.  But when I ran the code a second time, result() still came  
back empty.  That is, in the second attempt I set the defaultFolder  
to /Volumes/MountedDrive/Folder/ when it should not be possible,  
because there wasn't even a physical connection.

Whats interesting, is that i opened the console and listed the drives  
available in /Volumes/ and sure enough "MountedDrive" was listed  
despite the fact that it wasn't listed in the Finder.  I even  
rebooted with no network cable and "MountedDrive" still appeared in / 
Volumes/.
So I tried one last thing, if the defaultFolder was truly set to  
"MountedFolder" then my file moving code should work, right? Wrong.   
That code threw an error and failed as you would expect since there  
was no connection!

Does anyone know why this is?  Is there some period of time that old  
connections are retained in a lookup table b4 being removed?  I'd  
really like a solid mechanism to ensure that the drive is mounted,  
and the above does not seem to provide that.

Cheers,
Emilio


More information about the use-livecode mailing list