diff --git a/.gitmodules b/.gitmodules index f0bb794..c1207de 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,7 +4,7 @@ [submodule "deps/curl"] path = deps/curl url = https://github.com/curl/curl.git - branch = curl-8_5_0 + branch = curl-8_7_1 [submodule "deps/rapidjson"] path = deps/rapidjson url = https://github.com/Tencent/rapidjson.git diff --git a/README.md b/README.md index 891fd88..ab41d02 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,20 @@ This is the tool we use to pull changes made from the release page of some of ou - Install [Premake5][premake5-link] and add it to your system PATH - Clone this repository using [Git][git-link] - Update the submodules using ``git submodule update --init --recursive`` -- Run Premake with either of these two options ``premake5 vs2022`` (Windows) or ``premake5 gmake2`` (Linux/macOS) +- Run Premake with either of these two options ``premake5 vs2022`` (for Windows) or ``premake5 gmake2`` (for Linux/macOS) + - On Windows, build the project via the solution file in ``build\aw-installer.sln`` + - On Linux/macOS, build the project using [Make][make-link] via the ``Makefile`` located in the ``build`` folder **IMPORTANT** Requirements for Unix systems: -- Compilation: Please use Clang as the preferred compiler -- Dependencies: Ensure the LLVM C++ Standard library is installed +- Compilation: Please use Clang +- Dependencies: Ensure the LLVM [C++ Standard library][libcxx-link] is installed - Alternative compilers: If you opt for a different compiler such as GCC, use the [Mold][mold-link] linker - Customization: Modifications to the Premake5.lua script may be required - Platform support: Details regarding supported platforms are available in [build.yml](.github/workflows/build.yml) [premake5-link]: https://premake.github.io [git-link]: https://git-scm.com +[make-link]: https://en.wikipedia.org/wiki/Make_(software) +[libcxx-link]: https://libcxx.llvm.org/ [mold-link]: https://github.com/rui314/mold diff --git a/deps/curl b/deps/curl index 7161cb1..de7b3e8 160000 --- a/deps/curl +++ b/deps/curl @@ -1 +1 @@ -Subproject commit 7161cb17c01dcff1dc5bf89a18437d9d729f1ecd +Subproject commit de7b3e89218467159a7af72d58cea8425946e97d diff --git a/src/utils/compression.cpp b/src/utils/compression.cpp index ede874e..d85ae03 100644 --- a/src/utils/compression.cpp +++ b/src/utils/compression.cpp @@ -46,10 +46,10 @@ namespace utils::compression z_stream& get() { - return stream_; // + return stream_; } - bool is_valid() const + [[nodiscard]] bool is_valid() const { return valid_; } @@ -177,7 +177,7 @@ namespace utils::compression } // I apologize for writing such a huge function - // I'm Using make_preferred() so / are converted to \\ on Windows but not on POSIX + // I'm using make_preferred() so / are converted to \\ on Windows but not on POSIX void archive::decompress(const std::string& filename, const std::filesystem::path& out_dir) { unzFile file = unzOpen(filename.c_str()); @@ -229,7 +229,7 @@ namespace utils::compression // Entry is a file. Extract it. if (unzOpenCurrentFile(file) != UNZ_OK) { - // Could not read file from the ZIP + unzClose(file); throw std::runtime_error(string::va("Failed to read file \"%s\" from \"%s\"", out_file.c_str(), filename.c_str())); } @@ -243,6 +243,8 @@ namespace utils::compression std::ofstream out(path.make_preferred().string(), std::ios::binary | std::ios::trunc); if (!out.is_open()) { + unzCloseCurrentFile(file); + unzClose(file); throw std::runtime_error("Failed to open stream"); } @@ -252,6 +254,8 @@ namespace utils::compression read_bytes = unzReadCurrentFile(file, read_buffer, READ_BUFFER_SIZE); if (read_bytes < 0) { + unzCloseCurrentFile(file); + unzClose(file); throw std::runtime_error(string::va("Error while reading \"%s\" from the archive", out_file.c_str())); } @@ -273,6 +277,7 @@ namespace utils::compression // Go the the next entry listed in the ZIP file. if ((i + 1) < global_info.number_entry) { + // According to the AI overlords I do not need to close the file with unzCloseCurrentFile here if (unzGoToNextFile(file) != UNZ_OK) { break; diff --git a/src/utils/io.cpp b/src/utils/io.cpp index 2dacd20..763213c 100644 --- a/src/utils/io.cpp +++ b/src/utils/io.cpp @@ -8,12 +8,12 @@ namespace utils::io { bool remove_file(const std::string& file) { - return remove(file.c_str()) == 0; + return std::remove(file.c_str()) == 0; } bool move_file(const std::string& src, const std::string& target) { - return rename(src.c_str(), target.c_str()) == 0; + return std::rename(src.c_str(), target.c_str()) == 0; } bool file_exists(const std::string& file)