From f9d10fb1c76c9855afc8c37fb44f1991ffd70a67 Mon Sep 17 00:00:00 2001 From: Cosmin765 Date: Fri, 10 May 2024 23:51:09 +0300 Subject: [PATCH 1/6] Fix reported bug --- GViewCore/src/ZIP/zip.cpp | 29 +++++++++++++++++++++++++++++ Types/ZIP/src/ZIPFile.cpp | 4 ++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/GViewCore/src/ZIP/zip.cpp b/GViewCore/src/ZIP/zip.cpp index fd0726bc..b1271b3f 100644 --- a/GViewCore/src/ZIP/zip.cpp +++ b/GViewCore/src/ZIP/zip.cpp @@ -384,6 +384,35 @@ bool GetInfo(std::u16string_view path, Info& info) auto& entry = internalInfo->entries.emplace_back(); ConvertZipFileInfoToEntry(zipFile, entry); + std::u8string_view filename = entry.filename; + if (entry.type == EntryType::Directory && filename[filename.size() - 1] == '/') { + filename = { filename.data(), filename.size() - 1 }; + } + + size_t offset = 0; + + while (true) { + size_t pos = filename.find_first_of('/', offset); + + CHECKBK(pos != std::string::npos, ""); + + // add the parent as well if not already present + auto parentFilename = entry.filename.substr(0, pos + 1); + + auto it = std::find_if( + internalInfo->entries.begin(), internalInfo->entries.end(), [&](const _Entry& e) -> bool { return e.filename == parentFilename; }); + if (it == internalInfo->entries.end()) { + auto& parentEntry = internalInfo->entries.emplace_back(); + parentEntry.filename = parentFilename; + parentEntry.filename_size = parentFilename.size(); + parentEntry.type = EntryType::Directory; + parentEntry.version_madeby = entry.version_madeby; + parentEntry.version_needed = entry.version_needed; + } + + offset = pos + 1; + } + CHECKBK(mz_zip_reader_goto_next_entry(internalInfo->reader.value) == MZ_OK, ""); } while (true); diff --git a/Types/ZIP/src/ZIPFile.cpp b/Types/ZIP/src/ZIPFile.cpp index 0c92d7a1..d27d5207 100644 --- a/Types/ZIP/src/ZIPFile.cpp +++ b/Types/ZIP/src/ZIPFile.cpp @@ -71,7 +71,7 @@ bool ZIPFile::BeginIteration(std::u16string_view path, AppCUI::Controls::TreeVie CHECK(usb.Set(filename), false, ""); const auto sv = usb.ToStringView(); - if (sv.size() != path.size() && sv.starts_with(path)) { + if (sv.size() > path.size() && sv.starts_with(path) && sv[path.size()] == '/') { const auto tmpSV = std::u16string_view{ sv.data() + path.size(), sv.size() - path.size() }; if (tmpSV.find_first_of('/') == tmpSV.find_last_of('/')) { curentChildIndexes.push_back(i); @@ -205,7 +205,7 @@ class PasswordDialog : public Window, public Handlers::OnButtonPressedInterface }; void ZIPFile::OnOpenItem(std::u16string_view path, AppCUI::Controls::TreeViewItem item) -{ + { CHECKRET(item.GetParent().GetHandle() != InvalidItemHandle, ""); const auto index = item.GetData(-1); From d422c24da163ab698d1011b174220ac98b91eb74 Mon Sep 17 00:00:00 2001 From: Cosmin765 Date: Fri, 10 May 2024 23:56:03 +0300 Subject: [PATCH 2/6] Fix curly brace --- Types/ZIP/src/ZIPFile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Types/ZIP/src/ZIPFile.cpp b/Types/ZIP/src/ZIPFile.cpp index d27d5207..62e95a04 100644 --- a/Types/ZIP/src/ZIPFile.cpp +++ b/Types/ZIP/src/ZIPFile.cpp @@ -205,7 +205,7 @@ class PasswordDialog : public Window, public Handlers::OnButtonPressedInterface }; void ZIPFile::OnOpenItem(std::u16string_view path, AppCUI::Controls::TreeViewItem item) - { +{ CHECKRET(item.GetParent().GetHandle() != InvalidItemHandle, ""); const auto index = item.GetData(-1); From 97a3dc70c6c8afda4c599bb4bdc4201a3a4a4a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gheorghi=C8=9B=C4=83=20Mutu?= Date: Sat, 11 May 2024 22:30:17 +0300 Subject: [PATCH 3/6] [Build] # fix MacOS build --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcd8e5c3..18025d39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,6 +38,9 @@ jobs: # # brew update # brew install pkg-config # brew upgrade + + - name: Install Ninja + run: brew install ninja - name: Configure CMake run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} From 487e4c7b0a1738e3d657e7a250f33b557295e5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gheorghi=C8=9B=C4=83=20Mutu?= Date: Sat, 11 May 2024 22:57:40 +0300 Subject: [PATCH 4/6] [Build] # fix MacOS build (2) --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18025d39..8a7076d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} build-macos: - runs-on: [macos-latest] + runs-on: [macos-13] # avoid ARM for now - https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources steps: - uses: actions/checkout@v2 with: @@ -38,9 +38,6 @@ jobs: # # brew update # brew install pkg-config # brew upgrade - - - name: Install Ninja - run: brew install ninja - name: Configure CMake run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} From 04810780f8ff2390fa621a7b93b24867cf25eb29 Mon Sep 17 00:00:00 2001 From: Gheorghita Mutu Date: Mon, 13 May 2024 12:00:43 +0300 Subject: [PATCH 5/6] [Core] ^ AppCUI update Signed-off-by: Gheorghita Mutu --- AppCUI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppCUI b/AppCUI index c03ec64b..39de8f9c 160000 --- a/AppCUI +++ b/AppCUI @@ -1 +1 @@ -Subproject commit c03ec64b1ab9b89dcb04a5f78f67f1c5b05b472f +Subproject commit 39de8f9c190c06a332011de45935bc78599ba89f From cd2c112232f7e886fa1aedaa3779f0ad66c40e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gheorghi=C8=9B=C4=83=20Mutu?= Date: Tue, 14 May 2024 00:22:44 +0300 Subject: [PATCH 6/6] [Core] ^ AppCUI update (2) --- .github/workflows/deploy_release.yml | 2 +- AppCUI | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_release.yml b/.github/workflows/deploy_release.yml index 8a2431fb..ca5d3223 100644 --- a/.github/workflows/deploy_release.yml +++ b/.github/workflows/deploy_release.yml @@ -63,7 +63,7 @@ jobs: retention-days: 1 build-macos: - runs-on: [macos-latest] + runs-on: [macos-13] # avoid ARM for now - https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources steps: - uses: actions/checkout@v2 with: diff --git a/AppCUI b/AppCUI index 39de8f9c..8fbf90f8 160000 --- a/AppCUI +++ b/AppCUI @@ -1 +1 @@ -Subproject commit 39de8f9c190c06a332011de45935bc78599ba89f +Subproject commit 8fbf90f897558cb3f1a3a25b520c5a20b1f49981