summaryrefslogtreecommitdiffhomepage
path: root/private
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-12-06 15:53:20 +0100
committerAmlal <amlalelmahrouss@icloud.com>2024-12-06 15:57:01 +0100
commit46a885ad913aa24543efb154886919ad30182229 (patch)
tree3f9d6887763d8e1ea66fc89ec9aadb22f4cb9abc /private
parent8723d3401c15cad5797697aea4735b8972aabafb (diff)
META: Friday bump.
Signed-off-by: Amlal <amlalelmahrouss@icloud.com>
Diffstat (limited to 'private')
-rw-r--r--private/tools/Common.h17
-rw-r--r--private/tools/Framework.h17
-rw-r--r--private/tools/make_application.sh3
-rw-r--r--private/tools/make_framework.json12
-rw-r--r--private/tools/src/Framework.cc68
5 files changed, 117 insertions, 0 deletions
diff --git a/private/tools/Common.h b/private/tools/Common.h
new file mode 100644
index 00000000..6a70c566
--- /dev/null
+++ b/private/tools/Common.h
@@ -0,0 +1,17 @@
+/**
+ Sat Oct 26 07:03:28 AM CEST 2024
+ (c) Amlal EL Mahrouss.
+*/
+
+#ifndef APPS_COMMON_H
+#define APPS_COMMON_H
+
+#include <cstdint>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cstring>
+#include <sstream>
+#include <filesystem>
+
+#endif // APPS_COMMON_H \ No newline at end of file
diff --git a/private/tools/Framework.h b/private/tools/Framework.h
new file mode 100644
index 00000000..48db2599
--- /dev/null
+++ b/private/tools/Framework.h
@@ -0,0 +1,17 @@
+/**
+ Thu Oct 17 07:57:43 CEST 2024
+ (c) Amlal EL Mahrouss.
+*/
+
+#ifndef APPS_FRAMEWORK_H
+#define APPS_FRAMEWORK_H
+
+#include <Common.h>
+
+#define kExecDirectory "ML/Exec/"
+#define kRsrcDirectory "ML/Resources/"
+#define kRootDirectory "ML/"
+#define kFKExtension ".fwrk"
+#define kAppExtension ".app"
+
+#endif // !APPS_FRAMEWORK_H
diff --git a/private/tools/make_application.sh b/private/tools/make_application.sh
new file mode 100644
index 00000000..2878f5b6
--- /dev/null
+++ b/private/tools/make_application.sh
@@ -0,0 +1,3 @@
+# !/bin/sh
+
+cp make_framework.o make_application.o \ No newline at end of file
diff --git a/private/tools/make_framework.json b/private/tools/make_framework.json
new file mode 100644
index 00000000..6071ebaa
--- /dev/null
+++ b/private/tools/make_framework.json
@@ -0,0 +1,12 @@
+{
+ "compiler_path": "g++",
+ "compiler_std": "c++20",
+ "headers_path": ["./"],
+ "sources_path": ["src/Framework.cc"],
+ "output_name": "make_framework.o",
+ "cpp_macros": [
+ "kMKFVersion=0x0100",
+ "kMKFVersionHighest=0x0100",
+ "kMKFVersionLowest=0x0100"
+ ]
+}
diff --git a/private/tools/src/Framework.cc b/private/tools/src/Framework.cc
new file mode 100644
index 00000000..29426d1e
--- /dev/null
+++ b/private/tools/src/Framework.cc
@@ -0,0 +1,68 @@
+/*
+ * Created on Thu Oct 17 08:00:42 CEST 2024
+ *
+ * Copyright (c) 2024 Amlal EL Mahrouss
+ */
+
+#include <cstdlib>
+#include <filesystem>
+#include <Framework.h>
+#include <vector>
+
+/// @brief This program makes a framework directory for ZKA OS.
+
+int main(int argc, char* argv[])
+{
+ std::vector<std::string> files;
+
+ auto ext = kFKExtension;
+
+ for (size_t i = 2UL; i < argc; ++i)
+ {
+ if (strcmp(argv[i], "-h") == 0)
+ {
+ std::cout << "make_framework: Framework/Application Creation Tool.\n";
+ std::cout << "make_framework: © Amlal EL Mahrouss, all rights reserved.\n";
+
+ return EXIT_SUCCESS;
+ }
+
+ if (strcmp(argv[i], "-a") == 0)
+ {
+ ext = kAppExtension;
+ continue;
+ }
+
+ files.push_back(argv[i]);
+ }
+
+ auto path = std::string(argv[1]);
+
+ if (!path.ends_with(ext))
+ return EXIT_FAILURE;
+
+ std::filesystem::path path_arg = path;
+
+ if (std::filesystem::create_directory(path_arg))
+ {
+ std::filesystem::create_directory(path_arg / kRootDirectory);
+ std::filesystem::create_directory(path_arg / kExecDirectory);
+
+ for (auto& file : files)
+ {
+ std::string file_cpy = file;
+
+ while (file_cpy.find("/") != std::string::npos)
+ {
+ file_cpy.erase(0, file_cpy.find("/"));
+ file_cpy.erase(file_cpy.find("/"), 1);
+ }
+
+ std::filesystem::copy(path, path_arg / kExecDirectory / file_cpy);
+ }
+
+ return EXIT_SUCCESS;
+ }
+
+ return EXIT_FAILURE;
+}