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

GMS 2 [SOLVED] zip_unzip() - How to save in a different location?

Discussion in 'Programming' started by FoxyOfJungle, Aug 23, 2019.

  1. FoxyOfJungle

    FoxyOfJungle Member

    Joined:
    Jul 18, 2018
    Posts:
    26
    The new version of Game Maker Studio 2.2.3.436 lets you disable the engine sandbox, this works with the "file_" functions, but doesn't work with zip_unzip().

    Is there any way to extract a zip to any location outside of "appdata"?

    I'm basically doing an update system, and I need to extract the files to the game folder...
    (I'm currently using a primitive form with CMD).
     
  2. BaBiA Game Studio

    BaBiA Game Studio Member

    Joined:
    Jun 20, 2016
    Posts:
    873
    Perhaps you could show us how you are calling zip_unzip as according to the manual it should work if you specify the full path.
     
  3. FoxyOfJungle

    FoxyOfJungle Member

    Joined:
    Jul 18, 2018
    Posts:
    26
    I was just testing on the keyboard event.. And for some reason it doesn't work and nothing appears on the console.
     
  4. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,780
    Print your path to the console, it's possible it's not what you think it is due to escape characters in the path string.

    Also someone else was having issues saving files to the game folder, search the forum and find the thread to see if he solved it, and in the meantime try saving to a folder that isn't the game folder just to rule it out. If you have more than 1 drive / partition try saving to the root of D or E or whatever drive letter is assigned to the drive that isn't C.
     
    Samuel Venable likes this.
  5. Samuel Venable

    Samuel Venable Time Killer

    Joined:
    Sep 13, 2016
    Posts:
    1,299
  6. FoxyOfJungle

    FoxyOfJungle Member

    Joined:
    Jul 18, 2018
    Posts:
    26
    The paths are correct and I already did this check. I really don't know if this is an engine bug ..
    I'm using this in keyboard key pressed event:

    Code:
    zip_unzip("C:\Temp\Archive.zip","C:\EXTRACTED");
    The file has 2.82MB only.
    Thank you.


    I use your extension, it is very useful, but I would like to extract all files in a particular folder without having to copy one by one because your extension has no extraction functions.
    Thank you.
     
  7. BaBiA Game Studio

    BaBiA Game Studio Member

    Joined:
    Jun 20, 2016
    Posts:
    873
    Instead of
    Code:
    zip_unzip("C:\Temp\Archive.zip","C:\EXTRACTED");
    have you tried it this way:
    Code:
    zip_unzip("C:\\Temp\\Archive.zip","C:\\EXTRACTED");
    Because in GMS2, the \ character is an escape character used in strings (with things like \n for newline). You might also be able to do this:
    Code:
    zip_unzip(@"C:\Temp\Archive.zip",@"C:\EXTRACTED");
    to turn do it as a string literal, which will take it verbatim.
     
    FoxyOfJungle and Samuel Venable like this.
  8. FoxyOfJungle

    FoxyOfJungle Member

    Joined:
    Jul 18, 2018
    Posts:
    26
    This way WORKS! Thank you so much, I already knew about this "\" but I didn't think it applied to that too lol.

    Thank you all!
     
  9. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,780
    That's the first thing I said in my post above but you said you already checked it lol.

    Glad you sorted it.
     
    FoxyOfJungle likes this.
  10. FoxyOfJungle

    FoxyOfJungle Member

    Joined:
    Jul 18, 2018
    Posts:
    26
    It's true, I'm sorry! I was trying so long to fix that I didn't even pay attention :p
     
    rIKmAN likes this.

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