Unreliable File Deletion

Tore Nilsen tore.nilsen at me.com
Sun Mar 28 16:59:00 EDT 2021



> 28. mar. 2021 kl. 21:20 skrev J. Landman Gay via use-livecode <use-livecode at lists.runrev.com>:
> 
> 
> Desktop and documents folders are okay, and it may be possible to read from the resources folder, but do you actually write to it? I don't know any OS that allows altering an executable, which includes Mac bundles.

I set up an application with the following code in the  stack script:

on preOpenStack
   put specialFolderPath("resources")& "/testfolder/" into tURL
   create folder tURL
end preOpenStack

In the script of a button I put the following:

on mouseUp

ask "Write something to go into the resource folder:"

put it into tText

put "file:" & specialFolderPath("resources") & "/testfolder/test.txt" into tURL

put url tURL into tData

put tText & return after tData

put textEncode(tData,"UTF-8") into url tURLanswer url tURL

end mouseUp


I then build a standalone for Mac and started the application. After running the script from the button three times I did find the file test.txt in the folder named «testfolder» inside the _MacOS folder in the contents folder of the app bundle. The file contained the exact three lines I had written. Whether or not this will work on windows I don’t know as I do not have any computer running Windows to try it on.

Best regards
Tore


More information about the use-livecode mailing list