'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
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:
parent
bdf8ac66b0
commit
faf6d691d9
4
.vscode/c_cpp_properties.json
vendored
4
.vscode/c_cpp_properties.json
vendored
@ -8,9 +8,9 @@
|
|||||||
"cppStandard": "c++23",
|
"cppStandard": "c++23",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${workspaceFolder}/getpkg/src",
|
"${workspaceFolder}/getpkg/src",
|
||||||
"${workspaceFolder}/getpkg/src/autogen"
|
"${workspaceFolder}/getpkg/src/autogen",
|
||||||
|
"${workspaceFolder}/getpkg/src/common"
|
||||||
]
|
]
|
||||||
// ... other settings ...
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": 4
|
"version": 4
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#include "ArchiveManager.hpp"
|
#include "ArchiveManager.hpp"
|
||||||
|
|
||||||
|
namespace common {
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
// Escape string for shell command
|
// Escape string for shell command
|
||||||
@ -50,4 +52,6 @@ bool ArchiveManager::unpack(const std::string& archivePath, const std::string& o
|
|||||||
cmd << shellEscape(outDir);
|
cmd << shellEscape(outDir);
|
||||||
int ret = std::system(cmd.str().c_str());
|
int ret = std::system(cmd.str().c_str());
|
||||||
return ret == 0;
|
return ret == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace common
|
@ -1,9 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
namespace common {
|
||||||
|
|
||||||
class ArchiveManager {
|
class ArchiveManager {
|
||||||
public:
|
public:
|
||||||
ArchiveManager();
|
ArchiveManager();
|
||||||
bool pack(const std::string& folderPath, const std::string& archivePath);
|
bool pack(const std::string& folderPath, const std::string& archivePath);
|
||||||
bool unpack(const std::string& archivePath, const std::string& outDir);
|
bool unpack(const std::string& archivePath, const std::string& outDir);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace common
|
@ -213,7 +213,7 @@ int install_tool(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unpack tool
|
// Unpack tool
|
||||||
ArchiveManager archiver;
|
common::ArchiveManager archiver;
|
||||||
if (!archiver.unpack(archivePath.string(), binDir.string())) {
|
if (!archiver.unpack(archivePath.string(), binDir.string())) {
|
||||||
std::cerr << "Failed to unpack tool archive." << std::endl;
|
std::cerr << "Failed to unpack tool archive." << std::endl;
|
||||||
return 1;
|
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::path archivePath = std::filesystem::path(home) / ".tmp" / (labeltag + ".tgz");
|
||||||
std::filesystem::create_directories(archivePath.parent_path());
|
std::filesystem::create_directories(archivePath.parent_path());
|
||||||
|
|
||||||
ArchiveManager archiver;
|
common::ArchiveManager archiver;
|
||||||
if (!archiver.pack(folder, archivePath.string())) {
|
if (!archiver.pack(folder, archivePath.string())) {
|
||||||
std::cerr << "Failed to create archive." << std::endl;
|
std::cerr << "Failed to create archive." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user