• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android [HELP] Save data not deleting on android

  • Thread starter flyspraysandwich
  • Start date
F

flyspraysandwich

Guest
What is causing my save data to not be deleted? I have a piece of code that loops through and deletes every file in the data folder, which works:
Code:
filename = file_find_first(working_directory + "*",fa_directory);
while(filename != "") {
    show_message_async(filename);
    file_delete(filename);
    filename = file_find_next();
}
But upon commenting out the deleting part "//file_delete(filename);", and running the game again, the files continue to exist, why is this? I have tried manually clearing the data/cache in the settings and uninstalling the app, but the data persists. I do not have this problem on PC.
 
Last edited by a moderator:

FrostyCat

Redemption Seeker
Here you are looking for directories to delete (note what you used for the second argument in file_find_first(), and you expect files to disappear?
 
Here you are looking for directories to delete (note what you used for the second argument in file_find_first(), and you expect files to disappear?
I thought so too at first, but when testing (at least on windows), all files matching the wild card are returned. Adding the fa_directory flag just seems to return directories in addition to the normal files.

Manual says:
"The attributes give the additional files you want to see, so the normal files are always returned when they satisfy the mask"

However, I tested on windows, so perhaps the behavior of file_find_first() on android strictly follows the flags and only returns directories. I don't have android to test, so please ignore the above if this is the case.

But upon commenting out the deleting part "//file_delete(filename);", and running the game again, the files continue to exist, why is this?
This part of your question confuses me. If you are commenting out the file_delete() line...of course the files won't be deleted. Can you be more specific?
 
F

flyspraysandwich

Guest
I thought so too at first, but when testing (at least on windows), all files matching the wild card are returned. Adding the fa_directory flag just seems to return directories in addition to the normal files.

Manual says:
"The attributes give the additional files you want to see, so the normal files are always returned when they satisfy the mask"

However, I tested on windows, so perhaps the behavior of file_find_first() on android strictly follows the flags and only returns directories. I don't have android to test, so please ignore the above if this is the case.



This part of your question confuses me. If you are commenting out the file_delete() line...of course the files won't be deleted. Can you be more specific?
So I delete the files right, but when commenting out the deleting part and running the game again, these files magically come back from the dead. This only happens on android and I have no idea what's happening.
 
How are you creating these files? Are they included in your project via the Included Files resource? Or do you create them via code at runtime.

You'd have to start by checking your code to make sure you are not recreating them anywhere.
 
Top