blob: 1070559859aef0a8be2434b933a003f65825a2cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
* Created on Thu Oct 17 08:00:42 CEST 2024
*
* Copyright (c) 2024 Amlal EL Mahrouss
*/
#include <Framework.h>
#include <Steps.h>
/// @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_app: Framework/Application Creation Tool.\n";
std::cout << "make_app: © Amlal EL Mahrouss, All rights reserved.\n";
std::cout << "make_app: -a: Application format.\n";
std::cout << "make_app: -s: Steps (Setup pages) format.\n";
std::cout << "make_app: -f: Framework format.\n";
return EXIT_SUCCESS;
}
if (strcmp(argv[i], "-a") == 0)
{
ext = kAppExtension;
continue;
}
else if (strcmp(argv[i], "-s") == 0)
{
ext = kStepsExtension;
continue;
}
else if (strcmp(argv[i], "-f") == 0)
{
ext = kFKExtension;
continue;
}
files.push_back(argv[i]);
}
auto path = std::string(argv[1]);
if (!std::filesystem::exists(path))
return EXIT_FAILURE;
std::filesystem::path path_arg = path + ext;
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;
}
|