From 92ac3869d3e51d4941ea0cc88f79457c08a46da1 Mon Sep 17 00:00:00 2001 From: George Marques Date: Mon, 26 Jun 2017 14:51:21 -0300 Subject: [PATCH] WinRT: Fix exporting problems - Replace spaces with %20, since appx don't like it. - Use .zip extension for custom package templates. --- platform/winrt/export/export.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/winrt/export/export.cpp b/platform/winrt/export/export.cpp index a4271af5b0..1544abcc8c 100644 --- a/platform/winrt/export/export.cpp +++ b/platform/winrt/export/export.cpp @@ -616,7 +616,7 @@ void AppxPackager::make_content_types() { Vector AppxPackager::make_file_header(FileMeta p_file_meta) { Vector buf; - buf.resize(BASE_FILE_HEADER_SIZE + p_file_meta.name.length()); + buf.resize(BASE_FILE_HEADER_SIZE + p_file_meta.name.replace(" ", "%20").length()); int offs = 0; // Write magic @@ -644,13 +644,13 @@ Vector AppxPackager::make_file_header(FileMeta p_file_meta) { offs += buf_put_int32(p_file_meta.uncompressed_size, &buf[offs]); // File name length - offs += buf_put_int16(p_file_meta.name.length(), &buf[offs]); + offs += buf_put_int16(p_file_meta.name.replace(" ", "%20").length(), &buf[offs]); // Extra data length offs += buf_put_int16(0, &buf[offs]); // File name - offs += buf_put_string(p_file_meta.name, &buf[offs]); + offs += buf_put_string(p_file_meta.name.replace(" ", "%20"), &buf[offs]); // Done! return buf; @@ -660,7 +660,7 @@ void AppxPackager::store_central_dir_header(const FileMeta p_file, bool p_do_has Vector &buf = central_dir_data; int offs = buf.size(); - buf.resize(buf.size() + BASE_CENTRAL_DIR_SIZE + p_file.name.length()); + buf.resize(buf.size() + BASE_CENTRAL_DIR_SIZE + p_file.name.replace(" ", "%20").length()); // Write magic offs += buf_put_int32(CENTRAL_DIR_MAGIC, &buf[offs]); @@ -686,7 +686,7 @@ void AppxPackager::store_central_dir_header(const FileMeta p_file, bool p_do_has offs += buf_put_int32(p_file.uncompressed_size, &buf[offs]); // File name length - offs += buf_put_int16(p_file.name.length(), &buf[offs]); + offs += buf_put_int16(p_file.name.replace(" ", "%20").length(), &buf[offs]); // Extra field length offs += buf_put_int16(0, &buf[offs]); @@ -703,7 +703,7 @@ void AppxPackager::store_central_dir_header(const FileMeta p_file, bool p_do_has offs += buf_put_int32(p_file.zip_offset, &buf[offs]); // File name - offs += buf_put_string(p_file.name, &buf[offs]); + offs += buf_put_string(p_file.name.replace(" ", "%20"), &buf[offs]); #ifdef OPENSSL_ENABLED // Calculate the hash for signing @@ -1968,8 +1968,8 @@ bool EditorExportPlatformWinrt::_get(const StringName &p_name, Variant &r_ret) c void EditorExportPlatformWinrt::_get_property_list(List *p_list) const { - p_list->push_back(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "appx")); - p_list->push_back(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "appx")); + p_list->push_back(PropertyInfo(Variant::STRING, "custom_package/debug", PROPERTY_HINT_GLOBAL_FILE, "zip")); + p_list->push_back(PropertyInfo(Variant::STRING, "custom_package/release", PROPERTY_HINT_GLOBAL_FILE, "zip")); p_list->push_back(PropertyInfo(Variant::INT, "architecture/target", PROPERTY_HINT_ENUM, "ARM,x86,x64"));