Landon
4/29/2008 8:35:00 PM
I apologize if this is a double post - I subscribed through the ruby-
lang web page, but didn't get any email back, then sent mail to
subscribe the manual way...same thing - no confirmation of response -
then I emailed the post.
First, the real problem I'm trying to solve is the enumeration of all
the valid drives on a Windows machine without ending up with windows
popups flying.
Related to this objective, I need to do it in a way which is is most
compatible with both pure ruby and JRuby in a single code base.
Finally, this ruby code cannot be interactive or create an interactive
situation...it has to run unattended.
What I'm finding is that on different windows machines, I'll get
various kinds of popups depending upon whether the drive doesn't exist
or has no media in it.
For example, on a windows machine with no floppy in the drive, if I go
to irb and type:
> File.exists?("a:")
I will get a Windows popup that has the title:
Windows - No Disk
The contents of the popup says: "Exception Processing Message
c0000013 Parameters 75b6bf9c 4 75b6bf9c 75b6bf9c
If I cancel the popup, it comes back once more. If I cancel it a 2nd
time, it finally returns to Ruby and the irb prompt.
Second variation on the problem is if I try to access something on the
CD-ROM assigned to D: but there is nothing in the D: drive. Again,
in irb, if I type:
> File.exists?("d:")
I will get a different kind of popup. This one's title says "ruby.exe
- No Disk" and the contents say "There is no disk in the drive. Please
insert a disk into drive D:"
If I put a begin/rescue around the File.exists? call, rescue is never
executed, so no exception is being thrown.
So, several questions come out of these experiments:
1) Is there an alternate, standard way to enumerate drives on a
windows machine using Ruby?
2) Is there a way to suppress these windows popups or alternatively
have Ruby throw an exception in these cases?
3) any other ideas?
Any help on overcoming these issues in a standard, Ruby way would be
very appreciated.
Thanks,
Landon