Skip to content

Utilities: Add karchive library #13160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HTRamsey
Copy link
Collaborator

This should replace all the other archiving tools and create a single interface

@HTRamsey HTRamsey force-pushed the dev-compression-karchive branch 2 times, most recently from 44c174d to 5d7de99 Compare July 10, 2025 07:27
@HTRamsey HTRamsey force-pushed the dev-compression-karchive branch from 5d7de99 to 9ef11d8 Compare July 10, 2025 08:05
@HTRamsey HTRamsey requested a review from Copilot July 10, 2025 11:25
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a unified karchive interface, replacing existing archiving tools with a single library-based API.

  • Introduces karchive namespace with createArchive and extractArchive methods
  • Implements format-specific reader/writer factories using KDE’s KArchive classes
  • Updates CMake to download and link the KDE karchive library via CPM

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Utilities/Compression/karchive.h Declares the public karchive API and logging
src/Utilities/Compression/karchive.cc Implements archive creation and extraction logic
src/Utilities/Compression/CMakeLists.txt Adds karchive source files and CPM package setup
Comments suppressed due to low confidence (2)

src/Utilities/Compression/karchive.cc:89

  • [nitpick] Consider adding unit tests for createArchive and extractArchive under various conditions (unsupported formats, missing directories, successful round-trip) to ensure reliability.
bool createArchive(const QString &directoryPath, const QString &archivePath)

src/Utilities/Compression/karchive.h:3

  • QString is used in the function signatures but not included here; add #include <QtCore/QString> to avoid compilation errors.
#include <QtCore/QLoggingCategory>

return false;
}

root->copyTo(outputDirectoryPath, true);
Copy link
Preview

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value of copyTo is ignored; you should check its result, log a warning on failure, and return false to accurately report extraction errors.

Suggested change
root->copyTo(outputDirectoryPath, true);
if (!root->copyTo(outputDirectoryPath, true)) {
qCWarning(karchiveLog) << "Failed to copy archive contents to output directory:" << outputDirectoryPath;
archive->close();
return false;
}

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant