You could also use FileXtra4 to do this same method (writing a file and then
deleting it), and you can delete the file without opening it.

Charlie Fiskeaux II
Media Designer
The Creative Group
www.cre8tivegroup.com
859/858-9054x29
cell: 859/608-9194

----- Original Message ----- 
From: "Brennan" <[EMAIL PROTECTED]>
To: "Lingo-L Digest" <[EMAIL PROTECTED]>
Sent: Thursday, July 24, 2003 7:34 AM
Subject: <lingo-l> detecting whether projector is running from write
protected drive


> 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!]
>


[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