The "xzip_add" Function
#
SyntaxArgument | Type | Description |
---|---|---|
arch | string | The full path and filename of the archive to create |
file1 | string/array | The full path and filename of a file to add to the archive, or array of file paths |
[file2] | string | Optional: Additional files to add to the archive (arrays not accepted) |
#
DescriptionAdds one or more files to an archive previously created with xzip_create
. Also returns true
or false
to indicate if the operation succeeded or failed. Note that this includes failure to overwrite an existing file flagged as read-only. (This can be determined with xzip_get_readonly
.)
note
If multiple files are input, even a single error will return false
even though other files succeeded. In this scenario, use xzip_report
to retrieve a list of failed files.
Input files should be written as a string containing the full path of the file to add, including drive letter. If a path points to a folder, the contents of the folder will be added, preserving the relative path of files and subfolders inside.
warning
At present, Xzip requires all files to have an extension. Also, although folders are supported, no two files can have the exact same file name even if they are separated by different folders!
important
Due to GameMaker's string handling, slashes in paths should be escaped (i.e. \\
, not \
). Do not add a final slash to directories!
Instead of listing individual files in the xzip_add
command, an array of file paths can be passed into the file1
argument instead. Only the first file argument will accept an array as input, and once detected, no further file arguments will be processed. You cannot combine array and string inputs in a single command.
Be warned that adding files takes time, and archiving many files at once can cause the game to temporarily appear frozen.