1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Android [HELP] Save data not deleting on android

Discussion in 'Programming' started by flyspraysandwich, Nov 7, 2019.

  1. flyspraysandwich

    flyspraysandwich Member

    Joined:
    Nov 7, 2019
    Posts:
    3
    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: Nov 7, 2019
  2. flyspraysandwich

    flyspraysandwich Member

    Joined:
    Nov 7, 2019
    Posts:
    3
    bump
    any help would be super appreciated
     
  3. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,607
    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?
     
  4. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,267
    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?
     
  5. flyspraysandwich

    flyspraysandwich Member

    Joined:
    Nov 7, 2019
    Posts:
    3
    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.
     
  6. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,267
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice