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

Windows [Solved] Did anyone get the disable Sandbox thing to work properly?

N

N0013

Guest
I'm using GMS2 & build the game as zip

I've tried the simple code to check the problem.
show_message(program_directory);
if file_exists("ez.zip") then {
zip_unzip("ez.zip",program_directory+"Data/"); }
else
{
show_message("File Not found!");
}

The result is
The message show correct place (same location of .exe)
but it's unzip to the Appdata/Local lol. Any idea ?

thanks.
 
N

N0013

Guest
Look like I can create folder in the same place with exe with this code

global.dir = program_directory()+"Data/";
if !(directory_exists(global.dir)) { directory_create(global.dir); }

But for unzip function

if file_exists("ez.zip") then {
zip_unzip("ez.zip",global.dir);
}

it's still unzip to the Appdata/Local

Now I've got an idea to copy the whole folder from Appdata to my game folder
but I'm not sure that file_manager extension will help me to do it since
it doesn't look like it have a function that can copy the whole folder with files in it.
 
Last edited by a moderator:
Look like I can create folder in the same place with exe with this code

global.dir = program_directory()+"Data/";
if !(directory_exists(global.dir)) { directory_create(global.dir); }

But for unzip function

if file_exists("ez.zip") then {
zip_unzip("ez.zip",global.dir);
}

it's still unzip to the Appdata/Local

Now I've got an idea to copy the whole folder from Appdata to my game folder
but I'm not sure that file_manager extension will help me to do it since
it doesn't look like it have a function that can copy the whole folder with files in it.
I think you can use directory_contents to get a list of all the files in a folder.

Perhaps @Samuel Venable , the author, could suggest a way to do it.
 
N

N0013

Guest
If you can help me with folder copy code that would be great too!
I'm trying to copy the Data folder from Appdata project directory to the game directory but my code doesn't work at all.

global.dir = get_program_directory();
directory_copy(working_directory+"Data/",global.dir+"Data/");


Maybe I'm doing it wrong.
Can anyone provide me a sample code?

EDIT* NVM finally got it to work now!!
By using this code
directory_copy(game_save_id + "Data", working_directory + "Data")


The result is it's copy all the file inside Data folder from Appdata to game directory!
Hope this help people who trying to do something like this.

PS. You also need file manager extension in order to do this!
 
Last edited by a moderator:
Top