On 2021-03-28 18:11, R.H. via use-livecode wrote:
@ Peter Reid

Your message found my attention.
Also I am working on Windows 10 and have the same problem using LC 9.6.1
Indy version.

The similar or same problem as you have: I want to delete the text file.
The command I issue is "detele file <pathname>". The error it returns:
"Can't delete file".

All 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.

In terms of (1) - its easy to determine - log the path you are using, or use 'there is a file <tFilePath>' (but make sure the file you are checking for / logging *is* actually the same path as being passed to 'delete file').

In terms of (2) - Windows and UNIX-derived OSes have a critical difference when it comes to filesystems - in UNIX land you can delete a file which another process has open, on Windows you can't. (Note: It is possible for multiple processes on Windows to open the same file, if none have requested exclusive access, but the file cannot be deleted/renamed/moved until it is not open by any process).

... // Delete temp file
... delete file ("binfile:"&tFilePath)
... put the result into tResult
... if "can't delete that file" is in tResult then

...... myMSG tHInfo & "File could not be deleted." &CR& tFilePath --> My
message handler

This script falls into category (1) above - you are giving delete file a binfile URL. The 'delete file' command requires a normal file path, not a URL of any kind.

Warmest Regards,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

_______________________________________________
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