summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-11-03 15:05:19 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-11-03 15:05:19 +0100
commite2c2361f335a45d1268481c17fea6f50aa03bbff (patch)
treee2fd2c4fd8cfe0b26277f64e975fbbf756f8a3c8 /tools
parent140d983c55e0f9a2d1829c997d7751f234703fb6 (diff)
IMP: MakeFramework tool, (Alpha)
- This tool is used to make frameworks and apps. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/Framework.h13
-rw-r--r--tools/make_framework.json10
-rw-r--r--tools/src/Framework.cc68
-rw-r--r--tools/src/MakeFramework.cc42
4 files changed, 81 insertions, 52 deletions
diff --git a/tools/Framework.h b/tools/Framework.h
index 9d5a6861..bc66658c 100644
--- a/tools/Framework.h
+++ b/tools/Framework.h
@@ -3,11 +3,14 @@
(C) EL Mahrouss Logic.
*/
-#pragma once
+#ifndef TOOLS_FRAMEWORK_H
+#define TOOLS_FRAMEWORK_H
#include <Common.h>
-#define kFKDLLDirectory "ZKA/DLL/"
-#define kFKManifestDirectory "ZKA/Manifests/"
-#define kFKRootDirectory "ZKA/"
-#define kFKExtension ".framework"
+#define kExecDirectory "ZKA/Exec/"
+#define kRootDirectory "ZKA/"
+#define kFKExtension ".fwrk"
+#define kAppExtension ".app"
+
+#endif // !TOOLS_FRAMEWORK_H
diff --git a/tools/make_framework.json b/tools/make_framework.json
index 4ef2d7b6..9709ff3a 100644
--- a/tools/make_framework.json
+++ b/tools/make_framework.json
@@ -2,12 +2,12 @@
"compiler_path": "g++",
"compiler_std": "c++20",
"headers_path": ["./"],
- "sources_path": ["src/MakeFramework.cc"],
- "output_name": "make_framework.exe",
+ "sources_path": ["src/Framework.cc"],
+ "output_name": "make_framework.o",
"cpp_macros": [
"__MKF_AMD64__",
- "cMKFVersion=0x0100",
- "cMKFVersionHighest=0x0100",
- "cMKFVersionLowest=0x0100"
+ "kMKFVersion=0x0100",
+ "kMKFVersionHighest=0x0100",
+ "kMKFVersionLowest=0x0100"
]
}
diff --git a/tools/src/Framework.cc b/tools/src/Framework.cc
new file mode 100644
index 00000000..1a678ec3
--- /dev/null
+++ b/tools/src/Framework.cc
@@ -0,0 +1,68 @@
+/*
+ * Created on Thu Oct 17 08:00:42 CEST 2024
+ *
+ * Copyright (c) 2024 EL Mahrouss Logic
+ */
+
+#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 Creation Tool.\n";
+ std::cout << "make_framework: © EL Mahrouss Logic, 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;
+}
diff --git a/tools/src/MakeFramework.cc b/tools/src/MakeFramework.cc
deleted file mode 100644
index af4ed0cb..00000000
--- a/tools/src/MakeFramework.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Created on Thu Oct 17 08:00:42 CEST 2024
- *
- * Copyright (c) 2024 EL Mahrouss Logic
- */
-
-#include <filesystem>
-#include <framework.h>
-
-/// @brief This program converts a PE32+ driver, into a custom format, the ZXD.
-/// @note ZXD is a format for ZKA signed drivers.
-int main(int argc, char* argv[])
-{
- for (size_t i = 1ul; i < argc; ++i)
- {
- if (strcmp(argv[i], "-h") == 0)
- {
- std::cout << "make_framework: Framework Creation Tool.\n";
- std::cout << "make_framework: © EL Mahrouss Logic, all rights reserved.\n";
-
- return 0;
- }
- }
-
- auto path = std::string(argv[1]);
-
- if (!path.ends_with(kFKExtension))
- return 1;
-
- std::filesystem::path path_arg = path;
-
- if (std::filesystem::create_directory(path_arg))
- {
- std::filesystem::create_directory(path_arg / kFKRootDirectory);
- std::filesystem::create_directory(path_arg / kFKManifestDirectory);
- std::filesystem::create_directory(path_arg / kFKDLLDirectory);
-
- return 0;
- }
-
- return 1;
-}