Weird file creation behaviour in android

I’m finding strange behaviour when creating files in android.

I have some code that creates a file with some given filename. If I then go into the android OS and delete the either the file or the folder containing the file I just created, next time I run the same code it doesn’t recreate the same file. Same code, same filename. If, however, I change the filename to something different, it does create the new file.

So it seems android can’t create the same filename twice in a row (or any time after that).

I’ve checked that JUCE shows the file as not existing after being deleted using existsAsFile (surprise surprise). I’ve even tried running .deleteFile() on the file I’ve already manually deleted, to no avail.

I’m creating/deleting the file in the location: File::getSpecialLocation(File::userDocumentsDirectory)

This is holding me up in releasing the android version of my app! Any ideas?

Changing to File::getSpecialLocation(File::userHomeDirectory) seems to have fixed this problem. However, I’m really reluctant to do this as now the files cant be accessed from the Android OS which is a big risk for release :frowning: