mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Set language encoding flag when using Pack Project as ZIP
This commit is contained in:
parent
2dd26a027a
commit
cadd08da9e
1 changed files with 22 additions and 6 deletions
|
@ -72,8 +72,8 @@ void ProjectZIPPacker::_zip_file(const String &p_path, const String &p_base_path
|
|||
data.resize(len);
|
||||
f->get_buffer(data.ptrw(), len);
|
||||
|
||||
String path = p_path.replace_first(p_base_path, "");
|
||||
zipOpenNewFileInZip(p_zip,
|
||||
String path = p_path.trim_prefix(p_base_path);
|
||||
zipOpenNewFileInZip4(p_zip,
|
||||
path.utf8().get_data(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
@ -82,7 +82,15 @@ void ProjectZIPPacker::_zip_file(const String &p_path, const String &p_base_path
|
|||
0,
|
||||
nullptr,
|
||||
Z_DEFLATED,
|
||||
Z_DEFAULT_COMPRESSION);
|
||||
Z_DEFAULT_COMPRESSION,
|
||||
0,
|
||||
-MAX_WBITS,
|
||||
DEF_MEM_LEVEL,
|
||||
Z_DEFAULT_STRATEGY,
|
||||
nullptr,
|
||||
0,
|
||||
0x0314, // "version made by", 0x03 - Unix, 0x14 - ZIP specification version 2.0, required to store Unix file permissions
|
||||
1 << 11); // Bit 11 is the language encoding flag. When set, filename and comment fields must be encoded using UTF-8.
|
||||
zipWriteInFileInZip(p_zip, data.ptr(), data.size());
|
||||
zipCloseFileInZip(p_zip);
|
||||
}
|
||||
|
@ -101,8 +109,8 @@ void ProjectZIPPacker::_zip_recursive(const String &p_path, const String &p_base
|
|||
if (cur == "." || cur == ".." || cur == project_data_dir_name) {
|
||||
// Skip
|
||||
} else if (dir->current_is_dir()) {
|
||||
String path = cs.replace_first(p_base_path, "") + "/";
|
||||
zipOpenNewFileInZip(p_zip,
|
||||
String path = cs.trim_prefix(p_base_path) + "/";
|
||||
zipOpenNewFileInZip4(p_zip,
|
||||
path.utf8().get_data(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
|
@ -111,7 +119,15 @@ void ProjectZIPPacker::_zip_recursive(const String &p_path, const String &p_base
|
|||
0,
|
||||
nullptr,
|
||||
Z_DEFLATED,
|
||||
Z_DEFAULT_COMPRESSION);
|
||||
Z_DEFAULT_COMPRESSION,
|
||||
0,
|
||||
-MAX_WBITS,
|
||||
DEF_MEM_LEVEL,
|
||||
Z_DEFAULT_STRATEGY,
|
||||
nullptr,
|
||||
0,
|
||||
0x0314, // "version made by", 0x03 - Unix, 0x14 - ZIP specification version 2.0, required to store Unix file permissions
|
||||
1 << 11); // Bit 11 is the language encoding flag. When set, filename and comment fields must be encoded using UTF-8.
|
||||
zipCloseFileInZip(p_zip);
|
||||
_zip_recursive(cs, p_base_path, p_zip);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue