summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMatthew Kosarek <mattkae@protonmail.com>2021-07-18 20:43:15 -0400
committerMatthew Kosarek <mattkae@protonmail.com>2021-07-18 20:43:15 -0400
commit62817a0737a7ea7e0a6d54647648b9ab07280f44 (patch)
tree3b1e905bde07fb255575cf0517449c86ecd24ae7 /tools
parent25dba9a853ba2aaab3cc89214927d74a774a01a2 (diff)
(mkosarek) better mathlib now containing quaternions
Diffstat (limited to 'tools')
-rwxr-xr-xtools/zipper/build.sh1
-rw-r--r--tools/zipper/test_file.txt1
-rwxr-xr-xtools/zipper/zipperbin0 -> 49928 bytes
-rw-r--r--tools/zipper/zipper.cpp65
4 files changed, 67 insertions, 0 deletions
diff --git a/tools/zipper/build.sh b/tools/zipper/build.sh
new file mode 100755
index 0000000..4c4b337
--- /dev/null
+++ b/tools/zipper/build.sh
@@ -0,0 +1 @@
+g++ -o zipper zipper.cpp
diff --git a/tools/zipper/test_file.txt b/tools/zipper/test_file.txt
new file mode 100644
index 0000000..980a0d5
--- /dev/null
+++ b/tools/zipper/test_file.txt
@@ -0,0 +1 @@
+Hello World!
diff --git a/tools/zipper/zipper b/tools/zipper/zipper
new file mode 100755
index 0000000..bbbba43
--- /dev/null
+++ b/tools/zipper/zipper
Binary files differ
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 <string>
#include <vector>
+#include <iostream>
+#include <fstream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <dirent.h>
+
+std::vector<std::string> directoryFiles;
+
+const std::vector<std::string> 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;
}