Finding the CD-ROM Drive

Ideas supplied by...
  1. Jeff Patterson
  2. Daniel Devolder
  3. Darren Giles

Techniquue by Jeff Patterson

Date:    Fri, 2 Jun 1995 15:42:58 -0400
From:    Jeff Patterson <PixelG@AOL.COM>
Subject: Re: How do you detect the CD-ROM drive letter?
I modified this handler from someone else on the list.

This handler searches through all the possible drive letters on a user's PC to find the CD-ROM drive letter (which isn't always "D"). This handler assumes that:

on Checkpaths
  openXlib "Fileio.dll"
  set the itemdelimiter to "\"
  repeat with i = 67 to 90
    set drive = numToChar(i)
    set thisPath = drive & ":intrmuse.aif"
    set myFile = fileIO(mNew,"read",thisPath)
    if objectP(myFile) then
      set userCDDrive = drive
      set the SearchPath =  [userCDDrivex & ":\"]
      exit
      closeXlib "Fileio.dll"
    end if
  end repeat
  closeXlib "Fileio.dll"
  alert "Please check that the disc is in your CD drive."
  updatestage
end

It does the trick for me. Other people are getting the drive letter from the installation program and writing the info to a text file to be read at the start up of the Director movie.


Technique by Daniel Devolder

Date:    Mon, 5 Jun 1995 12:28:47 GMT+0200
From:    Daniel Devolder <ddevolder@CEDSERVER.UAB.ES>
Subject: Re: How do you detect the CD-ROM drive letter?
What I do for the problem is to put a file in a directory of my CD-ROM with a name that makes it the first ("aardvark" or something like that) and then search that file with getNthFileNameInFolder (aPath, 1) with a repeat loop on the drive letter. That works!
on driveLetter
  repeat with i=68 to 91 -- search on letter "D" to "Z"
    set aFileName = getNthFileNameInFolder (numToChar (i) & "\ADIRONCD\", 1)
    if aFileName = "AARDVARK" then exit repeat
  end repeat
  if i < 91 then
  -- drive found
     return numToChar (i)
  else
  -- no CD-ROM in drive, code for i is more than the code for "Z"
     return ""
  end if
end driveLetter

Technique by Darren Giles

Date:    Fri, 3 Nov 1995 20:08:59 -0800
From:    Darren Giles <mars@netcom.com>
Subject: Re: Where's da drive?
The subject has come up several times on the list, and there seems to be a "sucessive refinement" of the lingo that will do it. Here's what I'm currently using (based on several suggestions by others).
on findPath macVolume, tagFile
  global gMediaPath
  global gEvilMachine
  global gMediaPath
  global gSeperator


  --  On the Mac, look for the tagfile by absolute pathname
  if (gEvilMachine = false) then
    set gSeperator = ":"
    set gMediaPath = macVolume & ":MEDIA:"
    if getNthFileNameInFolder(gMediaPath, 1) = tagFile then
      return
    end if
    alert "The disc must be in the CD-ROM drive."
    Quit
  end if

  --  On annoying Windows machines, search all drives by letter
  set gSeperator = "\"
  openXLib "FileIO.DLL"
  repeat with i = 67 to 90
    set driveLetter = numToChar (i)
    if getNthFileNameInFolder(driveLetter & ":\MEDIA", 1) = tagFile then
      set gMediaPath = driveLetter & ":\MEDIA\"
      return
    end if
  end repeat
  alert "The disc must be in the CD-ROM drive."
  Quit
end