Unreliable File Deletion

R.H. roland.huettmann at gmail.com
Tue Mar 30 06:00:25 EDT 2021


Referring Date: 2021-03-29 09:04:04 +0100
From: Mark Waddingham <mark at livecode.com>
Subject: Re: Unreliable File Deletion
Message-ID: <c42ce48e9618e0acffe4042e6d532c7f at livecode.com>

Environment: Windows 10, 64bit
LC: Version 9.6.1

Dear Mark, Richard and all

Thank you for your replies ))).

Your comments are -- of course -- right, but I made a mistake in posting
something that was incorrectly typed.

Your wrote:
> ll cases of people reporting bugs with 'delete file' on Windows that I
> have seen fall into one of two cases:
> 1) The path they give to 'delete file' is wrong.
> 2) The file they are trying to delete is open by the app, or by another
app.

I am using URL ("binfile:"&<filepath>) to read and write from and to the
file.
For deleting I was and I am using and always have been using "delete file
<pathname>".

Unfortunately, I stated this incorrectly when retyping it to compose it as
part of my message as I changed the original statement here and there, but
it is not in the actual statement. This is my mistake to post it as such
and I apologize.

The file is in a writeable/readable location. It is neither protected, nor
is it used by any other service/app.

On my system (Windows 10) asking for specialfolderpath("resources") result
in the following path: "C:/Users/Roland/Documents/LC-Recent/LSP_App". This
is so because I put it there.

It is in the DOCUMENTS folder and therefore should not give problems.
But the same problem with deleting appears also when using
specialfolderpath("documents").

At other times, it worked! It is not something that is very transparent for
now.

Since on the Desktop and in any such user directory I can delete files
without assigning Admin rigths, the problem should not be a system problem.
I can also issue a shell command, as I posted, to delete and it works well
without problems. This at least is my fallback in case LC does not delete
my temporary file/s. So, actually, I use my function and do not care as it
solves what it needs to solve (just replace the wrong "delete file
(binfile.." part and put "delete file <tPathname>").

I know that other apps can use files and then it will be possible to delete
such files for good reasons. But that is not the case here.

I can investigate other possibilities, but nevertheless, it should work in
such directory. If I find the time to check out the error also looking at
the system message, I will do and post if there is anything that makes it
more clear.

Thanks Richard for posting your additional error investigation. I will
check it out later as currently I am in a rush job.

Your posting:
> delete file tFile
>  if the result is not empty then
>      answer the result &" ("& sysError() &")"
>  end if

Regards to everyone here
Roland



More information about the use-livecode mailing list