set defaultFolder to non-existent folder behavior

Eric Chatonet eric.chatonet at sosmartsoftware.com
Sat Jun 25 04:44:54 EDT 2005


Hi Emilio,

Why don't you check if the volume or the folder does exists before  
setting the defaultFolder property?
If there is a folder tFolder then set the defaultFolder to tFolder
else...

Should be reliable...
Check also the volumes property.

Best Regards from Paris,

Eric Chatonet.

Le 24 juin 05 à 20:45, Emilio Gagliardi a écrit :

> 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.

----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------



More information about the use-livecode mailing list