diff options
| author | Amlal <amlal.elmahrouss@icloud.com> | 2025-02-18 17:03:17 +0100 |
|---|---|---|
| committer | Amlal <amlal.elmahrouss@icloud.com> | 2025-02-18 17:03:17 +0100 |
| commit | b119e2e741dc82bca93374df7c5e4cd4b6468bc1 (patch) | |
| tree | 2cc92ec7114ab85994b81a27b10a6a2fbbf4d22f /public/tools/make_app/src | |
| parent | 36ec3e50aa1328bed5f3d2cfbf6a0596caa7a7c5 (diff) | |
ADD: Refactor make_app command line to work with NeOS, like the open command.
Diffstat (limited to 'public/tools/make_app/src')
| -rw-r--r-- | public/tools/make_app/src/CommandLine.cc | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/public/tools/make_app/src/CommandLine.cc b/public/tools/make_app/src/CommandLine.cc index 3339bfe3..1858303b 100644 --- a/public/tools/make_app/src/CommandLine.cc +++ b/public/tools/make_app/src/CommandLine.cc @@ -7,70 +7,66 @@ #include <Framework.h> #include <Steps.h> +#include <LibCF/Array.h> + /// @brief This program makes a framework directory for NeKernel OS. int main(int argc, char* argv[]) { - std::vector<std::string> files; + LibCF::CFArray<const char*, 255> files; auto ext = kFKExtension; - for (size_t i = 2UL; i < argc; ++i) + for (SizeT i = 2UL; i < argc; ++i) { - if (strcmp(argv[i], "-h") == 0) + if (MmStrCmp(argv[i], "-h") == 0) { - std::cout << "make_app: Framework/Application Creation Tool.\n"; - std::cout << "make_app: © Amlal EL Mahrouss, All rights reserved.\n"; + MsgAlloc(kAlertMsg); + + MsgSend(kAlertMsg, "%s", "make_app: Framework/Application Creation Tool.\n"); + MsgSend(kAlertMsg, "%s", "make_app: © Amlal EL Mahrouss, All rights reserved.\n"); + + MsgSend(kAlertMsg, "%s", "make_app: -a: Application format.\n"); + MsgSend(kAlertMsg, "%s", "make_app: -s: Steps (Setup pages) format.\n"); + MsgSend(kAlertMsg, "%s", "make_app: -f: Framework format.\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"; + MsgShow(kAlertMsg); + MsgFree(kAlertMsg); return EXIT_SUCCESS; } - if (strcmp(argv[i], "-a") == 0) + if (MmStrCmp(argv[i], "-a") == 0) { ext = kAppExtension; continue; } - else if (strcmp(argv[i], "-s") == 0) + else if (MmStrCmp(argv[i], "-s") == 0) { ext = kStepsExtension; continue; } - else if (strcmp(argv[i], "-f") == 0) + else if (MmStrCmp(argv[i], "-f") == 0) { ext = kFKExtension; continue; } - files.push_back(argv[i]); + files[i] = argv[i]; } - auto path = std::string(argv[1]); + auto path = argv[1]; - if (!std::filesystem::exists(path)) - return EXIT_FAILURE; - - std::filesystem::path path_arg = path + ext; - - if (std::filesystem::create_directory(path_arg)) + if (FsCreateDir(path)) { - std::filesystem::create_directory(path_arg / kRootDirectory); - std::filesystem::create_directory(path_arg / kExecDirectory); + FsCreateDir(StrFmt("{}{}", path, kRootDirectory)); + FsCreateDir(StrFmt("{}{}", path, kExecDirectory)); - for (auto& file : files) + for (SInt32 i = 0; i < files.Count(); ++i) { - 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); - } + auto& file = files[i]; - std::filesystem::copy(path, path_arg / kExecDirectory / file_cpy); + FsCopy(path, StrFmt("{}{}", path, file)); } return EXIT_SUCCESS; |
