zip_unzip

Unzip a given zip file to a specific location.

Syntax:

GML Code Example

zip_unzip(zip_file, target_directory)


Argument Description
zip_file The zip file to open
target_directory The target directory to extract the files to


Returns: Real


Description

This function will open a stored zip file and extract its contents to the given directory, within the sandboxed working directory for the game. The zip must be either part of the game bundle (ie: an Included File) or have been downloaded to the storage area using http_get_file, and you need to give the full path within the working directory to save the file to.

The function will return a value indicating the number of files extracted, or it will return 0 or less if the extraction has failed.


Example:

GML Code Example

var num = zip_unzip("/downloads/level_data.zip", "/extracted/");
 if num <= 0
    {
    show_debug_message("Extraction Failed!");
    }
 

The above code will open the zip file stored in the directory "downloads" and extract its contents to the directory "extracted" (creating that directory if it doesn't already exist) and then check to see that the extraction has been correct, showing a debug message should it fail.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here