1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

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

Discussion in 'Programming' started by N0013, Dec 4, 2019.

Tags:
  1. N0013

    N0013 Member

    Joined:
    Dec 4, 2019
    Posts:
    4
    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.
     
  2. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,313
    N0013 likes this.
  3. N0013

    N0013 Member

    Joined:
    Dec 4, 2019
    Posts:
    4
  4. N0013

    N0013 Member

    Joined:
    Dec 4, 2019
    Posts:
    4
    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: Dec 5, 2019
  5. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,313
    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.
     
    N0013 likes this.
  6. N0013

    N0013 Member

    Joined:
    Dec 4, 2019
    Posts:
    4
    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: Dec 5, 2019

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