Where am I? (volume)

Howard Bornstein bornstein at designeq.com
Fri Jul 12 12:50:01 EDT 2002

>I am hoping users of my nearly finished camera tutorial will copy it to
>their hard drives, but some may simply run it from the distribution CD. Is
>there some way in RR to determine what "kind" of volume a RR app is running
>from? I use several "waits" at various points to regulate the speed of
>animations and I would like the app to be able to adjust this for slower CD

You could try two things:

1) Since it's your distribution CD, you know the volume name. Once the 
defaultfolder is set to a file in that volume (i.e. by having them select 
a file from the volume) you can get the volume name thusly:

  put the defaultfolder into df
  set the itemdelimiter to "/"
  delete the first char of df
  put the first item of df into volname
  if volname = "your cd name" then
     -- you're running off the CD
  end if

2) A quick and dirty method of determining if it's a CD (not the best 
approach) is to try to write a file to the CD. If you get an error, then 
it's write protected (and thus probably a CD--again, the defaultfolder 
must already be pointed at the CD):

   open file "test" for write
   if the result is "Can't open that file" then
      -- CD-specific code
   end if


Howard Bornstein
D E S I G N  E Q

More information about the Use-livecode mailing list