• 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!

GameMaker directory_destroy not working on Android

Hey everyone! I am currently porting my game to mobile devices and so far the intregration has been easy. However, this line is not working properly:

var sav = "Save 0";
if(directory_exists(sav)){
directory_destroy(sav);
}

This line works perfectly on windows but not working on android. The file is not being deleted on android. I am using GM2 and testing on a Xaomi device. I don't know if there is a limitation with this function or if any sandbox features don't make it work adequately on mobile. If anyone can point me in the right direction, that would be nice!

I have already tried:
  • Enabling the permissions for writing to external storage and reading the phone state
  • adding working_directory at the beggning of my directory
  • Tried deleting any spaces to the file
I already posted a thread on reddit and someone was kind enough to guide me but I still have no luck on deleting the folders I created. Any help would be appreciated
 

rytan451

Member
Try this in a fresh project:

GML:
var dirname = "test", out = ["false", "true"];

if (!directory_exists(dirname)) {
  directory_create(dirname);
}
directory_destroy(dirname);

show_debug_message("Directory '" + dirname + "' exists: " + out[directory_exists(dirname)]);
If the debug console shows the text:
Code:
Directory 'test' exists: true
Then there is a bug in GMS, and you should report the bug, including the above piece of code.
 
Try this in a fresh project:

GML:
var dirname = "test", out = ["false", "true"];

if (!directory_exists(dirname)) {
  directory_create(dirname);
}
directory_destroy(dirname);

show_debug_message("Directory '" + dirname + "' exists: " + out[directory_exists(dirname)]);
If the debug console shows the text:
Code:
Directory 'test' exists: true
Then there is a bug in GMS, and you should report the bug, including the above piece of code.
I'll give this a try in the weekend and let you know!
 
Top