What's the best way to find out if a file exists?

Graham Samuel livfoss at blueyonder.co.uk
Fri Mar 21 18:12:01 EST 2003


I want to do the most straightforward thing to implement the logic

  if exists(file someFilePath) then
    do something
  else
    do something else
  end if

I read in the Transcript Dictionary that you can't in fact use the 
'exists' construct on files, but that if you open a file for reading 
and it doesn't exist, the result contains "Can't open that file." Is 
this the only way to find out if a file exists, and does this result 
text stay exactly the same in all circumstances for all OS's?

As usual, any info gratefully received by

Graham
-- 
-------------------------------------------------------------------
          Graham Samuel / The Living Fossil Co. / UK & France



More information about the use-livecode mailing list