summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/AppMain.cxx
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-04-30 06:17:59 +0000
committerAmlal <amlalelmahrouss@icloud.com>2024-04-30 06:17:59 +0000
commit094218bcd2befe8c57d042db7a2945791f29c7a6 (patch)
tree045a19e28860280a29bb8fc218a6909343691878 /Private/Source/AppMain.cxx
parenta06c8a375f0c5f5e3613e9fe8228cebf442731ba (diff)
parentf86125cf437fb49587d588413d69646959a58541 (diff)
Merged in MHR-18 (pull request #10)
MHR-18
Diffstat (limited to 'Private/Source/AppMain.cxx')
-rw-r--r--Private/Source/AppMain.cxx68
1 files changed, 28 insertions, 40 deletions
diff --git a/Private/Source/AppMain.cxx b/Private/Source/AppMain.cxx
index 6a23e20d..966172df 100644
--- a/Private/Source/AppMain.cxx
+++ b/Private/Source/AppMain.cxx
@@ -26,48 +26,36 @@ EXTERN_C NewOS::Void AppMain(NewOS::Void) {
NewOS::FilesystemManagerInterface::Mount(newFS);
if (newFS->GetImpl()) {
- NewCatalog* mountCatalog = newFS->GetImpl()->GetCatalog("/Boot/");
-
- if (mountCatalog) {
- delete newFS->GetImpl()->CreateCatalog("/Boot/System/", 0,
- kNewFSCatalogKindDir);
- NewCatalog* newKernelCatalog =
- newFS->GetImpl()->CreateCatalog("/Boot/System/ExampleTextFile");
-
- if (newKernelCatalog)
- NewOS::kcout << "Catalog-Path-Name: " << newKernelCatalog->Name
- << NewOS::endl;
-
- NewOS::kcout << "Catalog-Path-Name: " << mountCatalog->Name
- << NewOS::endl;
-
- constexpr auto cDataSz = 512;
- NewOS::Char theData[cDataSz] = {
- "THIS FORK\rCONTAINS DATA\rAS\rYOU\rCAN\rSEE...THIS FORK\rCONTAINS "
- "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS "
- "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS "
- "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS "
- "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS "
- "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS "
- "DATA\rAS\rYOU\rCAN\rSEE..THIS FORK\rCONTAINS "
- "DATA\rAS\rYOU\rCAN\rSEE.."};
-
- NewFork theFork{0};
- NewOS::rt_copy_memory((NewOS::VoidPtr) "EditableText",
- (NewOS::VoidPtr)theFork.Name,
- NewOS::rt_string_len("EditableText"));
-
- theFork.Kind = NewOS::kNewFSDataForkKind;
- theFork.DataSize = cDataSz;
-
- newFS->GetImpl()->CreateFork(newKernelCatalog, theFork);
- newFS->GetImpl()->WriteCatalog(newKernelCatalog, theData, cDataSz);
-
- delete newKernelCatalog;
- delete mountCatalog;
+ NewCatalog* textCatalog = nullptr;
+
+ if (!newFS->GetImpl()->GetCatalog("/EditableText")) {
+ constexpr auto cDataSz = 512;
+ NewOS::Char theData[cDataSz] = {
+ "About NewKernel...\rNewKernel is the System behind "
+ "NewOS.\rFeaturing modern common features, yet innovative.\r"};
+
+ NewFork theFork{0};
+
+ NewOS::rt_copy_memory((NewOS::VoidPtr) "EditableText",
+ (NewOS::VoidPtr)theFork.Name,
+ NewOS::rt_string_len("EditableText"));
+
+ theFork.Kind = NewOS::kNewFSDataForkKind;
+ theFork.DataSize = cDataSz;
+
+ textCatalog = newFS->GetImpl()->CreateCatalog("/EditableText");
+
+ newFS->GetImpl()->CreateFork(textCatalog, theFork);
+ newFS->GetImpl()->WriteCatalog(textCatalog, theData, cDataSz);
} else {
- delete newFS->GetImpl()->CreateCatalog("/Boot/", 0, kNewFSCatalogKindDir);
+ NewOS::kcout << "Catalog already exists.\r";
}
+
+ char* buf = nullptr;
+
+ buf = (NewOS::Char*)newFS->GetImpl()->ReadCatalog(newFS->GetImpl()->GetCatalog("/EditableText"), 512);
+
+ NewOS::kcout << buf << NewOS::endl;
}
while (NewOS::ProcessScheduler::Shared().Leak().Run() > 0)