Naively I tried this in a button:

on mouseUp
   if exists(file "HereWeGo.txt") then
      open file "HereWeGo.txt" for write
   else
      put "no such file"
      end if
end mouseUp

AND the thing didn't work because 'exists' only works for objects within Livecode.

BUT this seems a reasonable way to check for a file's existence:

on mouseUp
      read from file "HereWeGo.txt" for 1 line
      if it is empty then
         put "no such file"
         end if
end mouseUp

Richmond.

On 2.04.2016 11:48, JB wrote:
If I open a file for read or write and the file does
not exist it will be created.  Is there a way to see
if the file exists before opening it?  I do not want
a file to be created if it does not exist.  I guess I
could check the creation date and if it was just
created then delete it but I was wondering if there
is a better way.

JB




_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to