summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-03 11:10:21 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-03 11:11:19 +0200
commit3e6f0c4ca9154ae7b921adb9c06c98b06780940b (patch)
tree47f5fa0aa34fe34d754cf9f8ac3bd91d7efde0a3
parentef665258eb745f1da8767d9c42f1076de4000cd5 (diff)
NewFS: IMP: When formating add the root catalog as well as do not let
the user remove the root directory. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--Private/Source/FS/NewFS.cxx8
-rw-r--r--Public/Developer/SystemLib/Headers/l18n.h24
2 files changed, 30 insertions, 2 deletions
diff --git a/Private/Source/FS/NewFS.cxx b/Private/Source/FS/NewFS.cxx
index c9dc4bbf..c3384e70 100644
--- a/Private/Source/FS/NewFS.cxx
+++ b/Private/Source/FS/NewFS.cxx
@@ -445,6 +445,9 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive) {
kcout << "Free-Sectors: " << hex_number(partBlock->FreeSectors) << endl;
kcout << "Sector-Size: " << hex_number(partBlock->SectorSize) << endl;
+ /// write the root catalog.
+ this->CreateCatalog(kNewFSRoot, 0, kNewFSCatalogKindDir);
+
return true;
}
@@ -576,7 +579,7 @@ _Output NewCatalog* NewFSParser::FindCatalog(_Input const char* catalogName,
// zero character.
parentName[--indexReverseCopy] = 0;
- // mandatory / character.
+ // mandatory '/' character.
parentName[--indexReverseCopy] = 0;
while (parentName[indexReverseCopy] != NewFilesystemHelper::Separator()) {
@@ -666,7 +669,8 @@ Boolean NewFSParser::CloseCatalog(_Input _Output NewCatalog* catalog) {
/// @param catalog The catalog structure.
/// @return
Boolean NewFSParser::RemoveCatalog(_Input const Char* catalogName) {
- if (!catalogName) {
+ if (!catalogName ||
+ StringBuilder::Equals(catalogName, NewFilesystemHelper::Root())) {
DbgLastError() = kErrorInternal;
return false;
}
diff --git a/Public/Developer/SystemLib/Headers/l18n.h b/Public/Developer/SystemLib/Headers/l18n.h
new file mode 100644
index 00000000..eb876770
--- /dev/null
+++ b/Public/Developer/SystemLib/Headers/l18n.h
@@ -0,0 +1,24 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once
+
+/// @brief Intlization primitives.
+
+#include <Headers/Defines.h>
+
+typedef UInt64Type IntlRef;
+
+/// @brief locale getter and setters.
+
+IntlRef IntlGetLocale(const char* name);
+BooleanType IntlSetLocale(const IntlRef intl);
+
+/// @brief locale helpers.
+
+/// @brief translate a string from a locale.
+const CharacterTypeUTF8* IntlTranslate(const CharacterTypeUTF8* input,
+ const IntlRef locale);