From 62817a0737a7ea7e0a6d54647648b9ab07280f44 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Sun, 18 Jul 2021 20:43:15 -0400 Subject: (mkosarek) better mathlib now containing quaternions --- tools/zipper/zipper.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'tools/zipper/zipper.cpp') diff --git a/tools/zipper/zipper.cpp b/tools/zipper/zipper.cpp index 1b54c40..08ae9cf 100644 --- a/tools/zipper/zipper.cpp +++ b/tools/zipper/zipper.cpp @@ -1,6 +1,71 @@ #include #include +#include +#include +#include +#include +#include + +std::vector directoryFiles; + +const std::vector files = { + "2d/rigidbody/rigidbody_1/main.cpp" +}; int main() { + struct dirent *entry = nullptr; + DIR *dp = nullptr; + + dp = opendir("shared_cpp"); + if (dp != nullptr) { + while ((entry = readdir(dp))) { + std::string sharedName = std::string("shared_cpp/") + entry->d_name; + directoryFiles.push_back(sharedName); + } + } + + closedir(dp); + + for (auto file : files) { + printf("Creating zip file for: %s\n", file.c_str()); + std::string zipCommand = ""; + + std::ifstream cppFile; + cppFile.open(file); + + if (!cppFile.is_open()) { + printf("Unable to create zip file for: %s\n", file.c_str()); + continue; + } + + std::string line; + std::ifstream outMainCpp("tmp.main.cpp"); + std::string buffer; + while (getline(cppFile, line)) { + if (line.rfind("#include ", 0) == 0) { + int sharedCppFind = line.find("shared_cpp"); + if (sharedCppFind != std::string::npos) { + line = line.substr(sharedCppFind + strlen("shared_cpp/")); + } + } + + buffer += line; + buffer += "\n"; + } + + outMainCpp << buffer; + outMainCpp.close(); + + std::string zipCommand = "zip "; + zipCommand += "tmp.main.cpp"; + + for (auto dirFile : directoryFiles) { + + } + + system(zipCommand.c_str()); + } + + //system("zip archive.zip test_file.txt"); return 0; } -- cgit v1.2.1