summaryrefslogtreecommitdiffhomepage
path: root/apps
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-11-03 19:58:43 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-11-03 19:59:29 +0100
commit4e7ea02ed492a1fc0b167392361673244f957cce (patch)
treee322d501ea922146e735ae7e14fd725cf3935f02 /apps
parente2c2361f335a45d1268481c17fea6f50aa03bbff (diff)
IMP: Refactor btb rules of SysChk, NetBoot and MakeFramework/MakeApp.
IMP: Rename tools directory to apps. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/Common.h14
-rw-r--r--apps/Framework.h16
-rw-r--r--apps/make_framework.json12
-rw-r--r--apps/src/Framework.cc68
4 files changed, 110 insertions, 0 deletions
diff --git a/apps/Common.h b/apps/Common.h
new file mode 100644
index 00000000..a9439bbf
--- /dev/null
+++ b/apps/Common.h
@@ -0,0 +1,14 @@
+/**
+ Sat Oct 26 07:03:28 AM CEST 2024
+ (C) EL Mahrouss Logic.
+*/
+
+#pragma once
+
+#include <cstdint>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cstring>
+#include <sstream>
+#include <filesystem>
diff --git a/apps/Framework.h b/apps/Framework.h
new file mode 100644
index 00000000..bc66658c
--- /dev/null
+++ b/apps/Framework.h
@@ -0,0 +1,16 @@
+/**
+ Thu Oct 17 07:57:43 CEST 2024
+ (C) EL Mahrouss Logic.
+*/
+
+#ifndef TOOLS_FRAMEWORK_H
+#define TOOLS_FRAMEWORK_H
+
+#include <Common.h>
+
+#define kExecDirectory "ZKA/Exec/"
+#define kRootDirectory "ZKA/"
+#define kFKExtension ".fwrk"
+#define kAppExtension ".app"
+
+#endif // !TOOLS_FRAMEWORK_H
diff --git a/apps/make_framework.json b/apps/make_framework.json
new file mode 100644
index 00000000..6071ebaa
--- /dev/null
+++ b/apps/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/apps/src/Framework.cc b/apps/src/Framework.cc
new file mode 100644
index 00000000..1a678ec3
--- /dev/null
+++ b/apps/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;
+}