The Case Of The Unreadable File

Ray G. Miller rgmiller at pacbell.net
Thu Feb 6 18:23:01 EST 2003


Greeting slueths,

I said:
> Thanks Yennie  & Ken,
> I'll try both today. I believe the client is using a laptop PC for the
> CD burning. I've heard that PC laptop CD burners are nortoriously
> error-prone. I'll check that out. The media he's using is "imation." Has
> anyone heard anything bad about that brand?
> 
> I'm using "detailed files()" to get the "correct" files in the first
> place. The problem with PC file generation is that the user can
> mis-label a file, which can't easily be done in the classic Mac
> platform. (I reallllly like the "TRUTH" of the resource fork!) The
> "detailed files()" delivers lots of goodies on Mac files, but there is
> not that much useful poop on WIN/UNIX files.
> 
> The script by Andu Novac from sonsothunder.com would, if it works, add
> only a few ticks to the display time.

The second item of the detailed files is not any help for determining
whether a file is readable or not.
The modified script from Andu Novac takes 4000 + ticks to return a
non-readable file, and 50-60 ticks to return a readable file status.

I developed the following script. It's a bit faster (1800 ticks for
non-readable, 25-30 ticks for readable), but it is far from ideal. 

What's strange is that the "try-catch" structure was up to 3 times
slower! "The result" seems to be the fastest way.

function verifyReadFile thePath,theStart,theCount
  set cursor to watch
  ## theStart = 1 and theCount = 64. I tried many values and 64 seems to
be the best

  put theStart - theCount into fromHere
  put 0 into increment
  put "" into errorNum
  put false into vBool
  
  if there is a file thePath then
    open file thePath for binary read
    
    repeat until (the result =  "eof") 
      #   try --•••••••• LOOKING for READ error
      
      add theCount to increment
      read from file thePath at (fromHere + increment) for theCount
      
      if the result = "eof" then
        put true into vBool
        exit repeat
        
      else if the result is not empty then
        put false into vBool
        exit repeat
      end if
      
      # catch errorNum
      # if errorNum is not empty then
      # put false into vBool
      # exit repeat
      # end if
      # end try
    end repeat
    
    close file thePath

    return vBool
  end if
end verifyReadFile

 
Any ideas?

Ray
-----------
Ray G. Miller
-----------
Turtlelips Productions
4009 Everett Ave.
Oakland, CA 94602
MailTo:rgmiller at pacbell.net
(V) 510.530.1971
(F) 510.482.3491



More information about the metacard mailing list