'Generic Commit'
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 48s
Build-Test-Publish / build (linux/arm64) (push) Successful in 57s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Successful in 8s
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Successful in 8s

This commit is contained in:
Your Name 2025-06-22 14:19:43 +12:00
parent bdf8ac66b0
commit faf6d691d9
4 changed files with 14 additions and 6 deletions

View File

@ -8,9 +8,9 @@
"cppStandard": "c++23",
"includePath": [
"${workspaceFolder}/getpkg/src",
"${workspaceFolder}/getpkg/src/autogen"
"${workspaceFolder}/getpkg/src/autogen",
"${workspaceFolder}/getpkg/src/common"
]
// ... other settings ...
}
],
"version": 4

View File

@ -9,6 +9,8 @@
#include "ArchiveManager.hpp"
namespace common {
namespace fs = std::filesystem;
// Escape string for shell command
@ -50,4 +52,6 @@ bool ArchiveManager::unpack(const std::string& archivePath, const std::string& o
cmd << shellEscape(outDir);
int ret = std::system(cmd.str().c_str());
return ret == 0;
}
}
} // namespace common

View File

@ -1,9 +1,13 @@
#pragma once
#include <string>
namespace common {
class ArchiveManager {
public:
ArchiveManager();
bool pack(const std::string& folderPath, const std::string& archivePath);
bool unpack(const std::string& archivePath, const std::string& outDir);
};
};
} // namespace common

View File

@ -213,7 +213,7 @@ int install_tool(int argc, char* argv[]) {
}
// Unpack tool
ArchiveManager archiver;
common::ArchiveManager archiver;
if (!archiver.unpack(archivePath.string(), binDir.string())) {
std::cerr << "Failed to unpack tool archive." << std::endl;
return 1;
@ -292,7 +292,7 @@ int publish_tool(int argc, char* argv[]) {
std::filesystem::path archivePath = std::filesystem::path(home) / ".tmp" / (labeltag + ".tgz");
std::filesystem::create_directories(archivePath.parent_path());
ArchiveManager archiver;
common::ArchiveManager archiver;
if (!archiver.pack(folder, archivePath.string())) {
std::cerr << "Failed to create archive." << std::endl;
return 1;