From bdf8ac66b01adfc375850e686a10cb8fa49a0f7a Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 22 Jun 2025 14:13:56 +1200 Subject: [PATCH] 'Generic Commit' --- getpkg/CMakeLists.txt | 3 ++- getpkg/src/{ => common}/assert.hpp | 6 +++++- getpkg/src/{ => common}/hash.cpp | 4 ++-- getpkg/src/{ => common}/hash.hpp | 4 ++-- getpkg/src/{ => common}/output.cpp | 4 ++-- getpkg/src/{ => common}/output.hpp | 4 ++-- getpkg/src/{ => common}/temp_directory.cpp | 4 ++-- getpkg/src/{ => common}/temp_directory.hpp | 4 ++-- getpkg/src/{ => common}/xxhash.hpp | 0 getpkg/src/main.cpp | 4 ++-- 10 files changed, 21 insertions(+), 16 deletions(-) rename getpkg/src/{ => common}/assert.hpp (98%) rename getpkg/src/{ => common}/hash.cpp (98%) rename getpkg/src/{ => common}/hash.hpp (87%) rename getpkg/src/{ => common}/output.cpp (98%) rename getpkg/src/{ => common}/output.hpp (97%) rename getpkg/src/{ => common}/temp_directory.cpp (97%) rename getpkg/src/{ => common}/temp_directory.hpp (92%) rename getpkg/src/{ => common}/xxhash.hpp (100%) diff --git a/getpkg/CMakeLists.txt b/getpkg/CMakeLists.txt index efc8ccf..79e07d5 100644 --- a/getpkg/CMakeLists.txt +++ b/getpkg/CMakeLists.txt @@ -32,7 +32,8 @@ add_dependencies(${PROJECT_NAME} run_prebuild_script) # Include directories target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/src/autogen - src) + src + src/common) # Find packages find_package(OpenSSL REQUIRED) diff --git a/getpkg/src/assert.hpp b/getpkg/src/common/assert.hpp similarity index 98% rename from getpkg/src/assert.hpp rename to getpkg/src/common/assert.hpp index 2620e1e..38c9a26 100644 --- a/getpkg/src/assert.hpp +++ b/getpkg/src/common/assert.hpp @@ -16,6 +16,8 @@ #include #include +namespace common { + // ANSI color codes namespace colors { constexpr const char* reset = "\033[0m"; @@ -243,4 +245,6 @@ void assert_failed( } } -#define ASSERT(condition, message) assert_failed(condition, message, std::source_location::current()) +#define ASSERT(condition, message) common::assert_failed(condition, message, std::source_location::current()) + +} // namespace common diff --git a/getpkg/src/hash.cpp b/getpkg/src/common/hash.cpp similarity index 98% rename from getpkg/src/hash.cpp rename to getpkg/src/common/hash.cpp index 71df35a..9463d61 100644 --- a/getpkg/src/hash.cpp +++ b/getpkg/src/common/hash.cpp @@ -9,7 +9,7 @@ #include #include -namespace dropshell { +namespace common { uint64_t hash_file(const std::string &path) { // Create hash state @@ -130,4 +130,4 @@ int hash_demo_raw(const std::string & path) return 0; } -} // namespace dropshell +} // namespace common diff --git a/getpkg/src/hash.hpp b/getpkg/src/common/hash.hpp similarity index 87% rename from getpkg/src/hash.hpp rename to getpkg/src/common/hash.hpp index f06da03..78dc275 100644 --- a/getpkg/src/hash.hpp +++ b/getpkg/src/common/hash.hpp @@ -4,7 +4,7 @@ #include #include -namespace dropshell { +namespace common { uint64_t hash_file(const std::string &path); @@ -16,7 +16,7 @@ namespace dropshell { int hash_demo_raw(const std::string & path); -} // namespace dropshell +} // namespace common #endif \ No newline at end of file diff --git a/getpkg/src/output.cpp b/getpkg/src/common/output.cpp similarity index 98% rename from getpkg/src/output.cpp rename to getpkg/src/common/output.cpp index 35eb7e2..963afa3 100644 --- a/getpkg/src/output.cpp +++ b/getpkg/src/common/output.cpp @@ -2,7 +2,7 @@ #include #include -namespace dropshell +namespace common { // Mutex to synchronize output std::mutex output_mutex; @@ -130,4 +130,4 @@ namespace dropshell SetColour(sColour::RESET, os_); } -} // namespace dropshell \ No newline at end of file +} // namespace common \ No newline at end of file diff --git a/getpkg/src/output.hpp b/getpkg/src/common/output.hpp similarity index 97% rename from getpkg/src/output.hpp rename to getpkg/src/common/output.hpp index f2c66d5..84d030d 100644 --- a/getpkg/src/output.hpp +++ b/getpkg/src/common/output.hpp @@ -6,7 +6,7 @@ #include #include -namespace dropshell { +namespace common { /* @@ -82,6 +82,6 @@ class SwitchColour sColour colour_; }; -} // namespace dropshell +} // namespace common #endif // OUTPUT_HPP \ No newline at end of file diff --git a/getpkg/src/temp_directory.cpp b/getpkg/src/common/temp_directory.cpp similarity index 97% rename from getpkg/src/temp_directory.cpp rename to getpkg/src/common/temp_directory.cpp index ab3594b..3a5d517 100644 --- a/getpkg/src/temp_directory.cpp +++ b/getpkg/src/common/temp_directory.cpp @@ -7,7 +7,7 @@ #include #include // For error reporting in destructor -namespace getpkg { +namespace common { TempDirectory::TempDirectory(const std::string& prefix) { auto temp_dir_base = std::filesystem::temp_directory_path(); @@ -60,4 +60,4 @@ std::string TempDirectory::string() const { return path_.string(); } -} // namespace simple_object_storage \ No newline at end of file +} // namespace common \ No newline at end of file diff --git a/getpkg/src/temp_directory.hpp b/getpkg/src/common/temp_directory.hpp similarity index 92% rename from getpkg/src/temp_directory.hpp rename to getpkg/src/common/temp_directory.hpp index c65a2e4..1726208 100644 --- a/getpkg/src/temp_directory.hpp +++ b/getpkg/src/common/temp_directory.hpp @@ -4,7 +4,7 @@ #include #include -namespace getpkg { +namespace common { // RAII helper for temporary directory cleanup class TempDirectory { @@ -25,6 +25,6 @@ private: std::filesystem::path path_; }; -} // namespace simple_object_storage +} // namespace common #endif // TEMP_DIRECTORY_HPP \ No newline at end of file diff --git a/getpkg/src/xxhash.hpp b/getpkg/src/common/xxhash.hpp similarity index 100% rename from getpkg/src/xxhash.hpp rename to getpkg/src/common/xxhash.hpp diff --git a/getpkg/src/main.cpp b/getpkg/src/main.cpp index e12228a..95363ae 100644 --- a/getpkg/src/main.cpp +++ b/getpkg/src/main.cpp @@ -148,7 +148,7 @@ int install_tool(int argc, char* argv[]) { std::string arch = get_arch(); std::string home = get_home(); - getpkg::TempDirectory tempDir; + common::TempDirectory tempDir; std::filesystem::path configDir = std::filesystem::path(home) / ".config/getpkg"; std::filesystem::path binDir = std::filesystem::path(home) / ".getpkg" / toolName; std::filesystem::path archivePath = tempDir.path() / (toolName + ".tgz"); @@ -486,7 +486,7 @@ int hash_command(int argc, char* argv[]) { return 1; } - uint64_t hash = dropshell::hash_path(path); + uint64_t hash = common::hash_path(path); std::cout << hash << std::endl; return 0; }