realbasic-nug
[Top] [All Lists]

Re: Finding Ejectable Volumes.

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Finding Ejectable Volumes.
From: Charles Yeomans <charles at declareSub dot com>
Date: Mon, 29 May 2006 19:06:37 -0400
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <20060523161033 dot 17E1D1296E9A at lists dot realsoftware dot com> <27EF305E-4049-497F-B82D-1B9753DD4D81 at aztech4mac dot com> <0E37A913-84EF-4342-8887-14E32DF7B912 at declareSub dot com> <fed2e2560605291252w56d99e65w721f1cf7258ee9dc at mail dot gmail dot com>
This appears to be a known problem; at least, I found the same question here and there using Google, but no answers. I thought it might be possible to use NSWorkspace, but it appears to have the same problem. What does appear to work is to ask the Finder via Apple script. Create a script called, say, "isVolumeEjectable" and implement it as follows.

on run {volumeName}
        tell application "Finder"
                return ejectable of disk volumeName
        end tell
end run

Then call it like so.

For i as Integer = 0 to VolumeCount - 1
  dim v as Variant = IsVolumeEjectable(Volume(i).Name)
Next

This script returns true for a mounted Firewire volume on my machine, and agrees with the result of calling PBHGetVolParmsSync for all other volumes mounted here.

Probably you could also try calling IOKit :)

Charles Yeomans



On May 29, 2006, at 3:52 PM, Dennis Birch wrote:

I implemented the suggested declares solution in a module and it works
great for CD-ROMs and USB devices I've mounted. However my external
FireWire drive (which can be safely unmounted in the Finder) does not
show as being ejectable. Anybody happen to know why that might be the
case?

On 5/23/06, Charles Yeomans <charles at declaresub dot com> wrote:
This information is not hard to retrieve for MacOS.  You call
PBHGetVolParmsSync.  You test the extended attributes field of the
GetVolParmsInfoBuffer struct passed.  The volume is ejectable when
bit 0 is set.  The Volumes section of chapter 4 of my declares book
has an example that calls PBHGetVolParmsSync.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>