Is there a way to avoid windows displaying this warning when deleting a file?
This happens when a user has their Documents folder synced with OneDrive which is frequently the case.
In my case, I save the user data to a temp file next to their existing save in Documents, delete the old save and rename the temp file to be their save. The user gets warned when deleting their save.
I don’t want to overwrite the existing save as a crash would render it corrupt.
^ This, and if you want to keep track of such temporary files and even recover them after a crash, maintain them in some fixed proper place for your app like SpecialFolder.ApplicationData.child(“MyAppFolderData”).Child(“MyTemporaryFile_2379457234.ess”)
That is not a solution, you should NOT change other programs options risking the user to data loss with ALL of their files just to avoid a single delete action from your program.
you could copy the original file to temp
and then overwrite the document folder with your new data.
if this fail copy back the temp file.
if all run well delete the temp file.
Just avoid those things as copy there / delete / copy back…, just create and use the temporary files in the proper temporary places, write or overwrite the final file where it belongs when finished, delete the temporary after (as they are only local, they won’t raise warnings about cloud synchronizing).
The actual copy is made by the OS, if the app crashes before the instruction, the file is not copied, since te copy is syncronous, the app cant really crash there, if crahses after, the file is already copied, so… what are you talking about?