The free FileXtra4 has a call, I think it's called fx_VolumeIsCDRom. I don't know what it would do with a DVD drive, but it would be easy for you to try it. It also has some other calls that you could play around with.

http://kblab.net/xtras/FileXtra4/

Irv

At 1:34 PM +0200 7/24/03, Brennan wrote:
Hi folks,

I want to find out whether my projector is running from a write protected
drive. I don't want to rely on Windows drive letters because I want a
cross platform solution and in any case, an increasing number of people
have more than one write protected drive on their windows box. (e.g. both
a DVD and CD drive).

This turned out to be trickier than I thought. I felt sure there would be
some system property, or that buddyAPI or fileio would do it for me.

In the end, I've opted for fileIO, but it's a bit messy. FileIO will not
report an error if I try to open a file with the 'write' flag set to true,
which strikes me as a bug.

It will, however, cause an error if I try to create a file on a
non-writable drive, although if the drive is writable, I then have to
'clean up' and remove the dummy file that got created, which requires also
that I open it. (You can only delete a file that is open with fileIO).
This seems like a lot of messing about, but it works.

Here's my code, does anyone have a slicker approach? Suggestions for
freeware xtras are welcome.

on moviePathWritable

  f = new(xtra "fileio")
  dummyFilePath = the moviepath & "zxxxxxxz.txt"
  f.createFile(dummyFilePath)
  errCode = f.status()

  if errCode <> 0 then
    -- some error, assume that disk can not be written to
    return false
  end if

  f.openfile(dummyFilePath, 0)
  f.delete()
  return true

end

Brennan
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]


--

Multimedia Wrangler.
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
with programming Lingo.  Thanks!]

Reply via email to