diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcd8e5c3..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: 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 c03ec64b..8fbf90f8 160000 --- a/AppCUI +++ b/AppCUI @@ -1 +1 @@ -Subproject commit c03ec64b1ab9b89dcb04a5f78f67f1c5b05b472f +Subproject commit 8fbf90f897558cb3f1a3a25b520c5a20b1f49981 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..62e95a04 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);