|
game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
|
Provides archive extraction using system tools. More...
#include <archive_extract_service.h>
Public Types | |
| using | ProgressCallback = std::function<void(int percent, const std::string& currentFile)> |
Static Public Member Functions | |
| static ArchiveType | detectType (const std::string &filePath) |
| Detect archive type from file. | |
| static ExtractResult | extract (const ExtractRequest &request, const ProgressCallback &progressCallback=nullptr) |
| Extract an archive. | |
| static void | extractAsync (const ExtractRequest &request, const std::function< void(const ExtractResult &)> &onComplete, const ProgressCallback &onProgress=nullptr) |
| Extract an archive asynchronously. | |
| static ArchiveInfo | getInfo (const std::string &archivePath) |
| Get archive information without extracting. | |
| static std::string | getInstallCommand (const std::string &toolName) |
| Get installation command for a tool. | |
| static std::string | getToolName (ArchiveType type) |
| Get the command-line tool used for a type. | |
| static std::string | getTypeName (ArchiveType type) |
| Get human-readable name for archive type. | |
| static bool | isSupported (ArchiveType type) |
| Check if extraction for a type is supported. | |
| static bool | isToolInstalled (const std::string &toolName) |
| Check if a tool is installed. | |
| static std::vector< std::string > | listContents (const std::string &archivePath) |
| List archive contents without extracting. | |
Provides archive extraction using system tools.
Uses external command-line tools for extraction:
Falls back gracefully if tools are not installed.
Definition at line 105 of file archive_extract_service.h.
| using ArchiveExtractService::ProgressCallback = std::function<void(int percent, const std::string& currentFile)> |
Definition at line 108 of file archive_extract_service.h.
|
static |
Detect archive type from file.
| filePath | Path to the archive |
Definition at line 188 of file archive_extract_service.cpp.
References Unknown.
Referenced by extract(), getInfo(), and listContents().
|
static |
Extract an archive.
| request | Extraction configuration |
| progressCallback | Called with extraction progress (if available) |
Definition at line 50 of file archive_extract_service.cpp.
References ExtractRequest::archivePath, Bzip2, Cab, ExtractRequest::destinationDir, ExtractResult::destinationDir, detectType(), Logger::error(), ExtractResult::errorMessage, getInstallCommand(), getToolName(), getTypeName(), Gzip, Logger::info(), InnoSetup, isSupported(), NSIS, Rar, SevenZip, Tar, TarBz2, TarGz, TarXz, TarZst, ExtractRequest::type, Unknown, Xz, and Zip.
Referenced by extractAsync().
|
static |
Extract an archive asynchronously.
| request | Extraction configuration |
| onComplete | Called when extraction finishes |
| onProgress | Called with extraction progress |
Definition at line 169 of file archive_extract_service.cpp.
References extract().
|
static |
Get archive information without extracting.
| archivePath | Path to the archive |
Definition at line 427 of file archive_extract_service.cpp.
References ArchiveInfo::compressedSize, ArchiveInfo::contents, detectType(), ArchiveInfo::fileCount, getTypeName(), listContents(), ArchiveInfo::type, and ArchiveInfo::typeName.
|
static |
Get installation command for a tool.
| toolName | Tool name |
Definition at line 631 of file archive_extract_service.cpp.
Referenced by extract().
|
static |
Get the command-line tool used for a type.
| type | Archive type |
Definition at line 587 of file archive_extract_service.cpp.
References Bzip2, Cab, Exe, Gzip, InnoSetup, NSIS, Rar, SevenZip, Tar, TarBz2, TarGz, TarXz, TarZst, Xz, and Zip.
Referenced by extract(), and isSupported().
|
static |
|
static |
Check if extraction for a type is supported.
| type | Archive type |
Definition at line 500 of file archive_extract_service.cpp.
References getToolName(), and isToolInstalled().
Referenced by extract().
|
static |
Check if a tool is installed.
| toolName | Tool name (e.g., "7z", "innoextract") |
Definition at line 619 of file archive_extract_service.cpp.
References ShellUtils::escapeArg().
Referenced by isSupported().
|
static |
List archive contents without extracting.
| archivePath | Path to the archive |
Definition at line 445 of file archive_extract_service.cpp.
References Cab, detectType(), ShellUtils::escapeArg(), InnoSetup, Rar, SevenZip, Tar, TarBz2, TarGz, TarXz, TarZst, and Zip.
Referenced by getInfo().