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
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.
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.