Finding the name of a USB volume

Phil Davis revdev at pdslabs.net
Wed Jan 6 20:50:58 EST 2010


On 1/6/10 3:31 PM, Richard Gaskin wrote:
> tsj wrote:
>> Richard - I haven't got an unnamed USB drive handy to test this with but
>> what does the volumes function return when one is mounted? Does this 
>> give
>> you the expected "untitled" (or "untitled 1" etc)?
>>
>> If so, you could iterate through the listed volumes using a couple of
>> applescripts to determine whether the drive was local (false if it's a
>> network drive) ejectable (false if it's internal) and then if you get 
>> two
>> false results you can attempt to open a file on the volume. If that 
>> gives
>> you an error then the drive is write protected. If it passes all 
>> tests then
>> you're left (presumably) with an external USB or Firewire drive.

The "passes all tests" list can also includes mounted .dmg files.

Thanks for posting this - very helpful.
-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net




More information about the use-livecode mailing list