diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-09-05 19:13:02 +0000 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-09-05 19:13:02 +0000 |
| commit | 621e814da6d5005ade8a1fe3f378a363db559cf7 (patch) | |
| tree | 438f1337c0eb2ae83cf3d409c29848d396be08b2 /dev/ZKA/Sources/NeFS+FileMgr.cxx | |
| parent | cc9ce57cac59bd443e2319e3b8f427172b93f7da (diff) | |
| parent | 3b60a1e87ab02a1b72d8bb9f7392780899d5a0d7 (diff) | |
Merged in major-refactor (pull request #19)
Major refactor
Diffstat (limited to 'dev/ZKA/Sources/NeFS+FileMgr.cxx')
| -rw-r--r-- | dev/ZKA/Sources/NeFS+FileMgr.cxx | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/dev/ZKA/Sources/NeFS+FileMgr.cxx b/dev/ZKA/Sources/NeFS+FileMgr.cxx new file mode 100644 index 00000000..b3ad381f --- /dev/null +++ b/dev/ZKA/Sources/NeFS+FileMgr.cxx @@ -0,0 +1,109 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#include <KernelKit/FileMgr.hxx> +#include <KernelKit/Heap.hxx> + +#ifdef __FSKIT_USE_NEFS__ + +/// @brief NeFS File manager. +/// BUGS: 0 + +namespace Kernel +{ + /// @brief C++ constructor + NewFilesystemMgr::NewFilesystemMgr() + { + MUST_PASS(Detail::fs_init_newfs()); + fImpl = new NeFSParser(); + MUST_PASS(fImpl); + + kcout << "We are done here... (NewFilesystemMgr).\r"; + } + + NewFilesystemMgr::~NewFilesystemMgr() + { + kcout << "Destroying it...\r"; + + if (fImpl) + { + delete fImpl; + } + } + + /// @brief Removes a node from the filesystem. + /// @param fileName The filename + /// @return If it was deleted or not. + bool NewFilesystemMgr::Remove(const Char* fileName) + { + if (fileName == nullptr || *fileName == 0) + return false; + + return fImpl->RemoveCatalog(fileName); + } + + /// @brief Creates a node with the specified. + /// @param path The filename path. + /// @return The Node pointer. + NodePtr NewFilesystemMgr::Create(const Char* path) + { + return node_cast(fImpl->CreateCatalog(path)); + } + + /// @brief Creates a node with is a directory. + /// @param path The filename path. + /// @return The Node pointer. + NodePtr NewFilesystemMgr::CreateDirectory(const Char* path) + { + return node_cast(fImpl->CreateCatalog(path, 0, kNeFSCatalogKindDir)); + } + + /// @brief Creates a node with is a alias. + /// @param path The filename path. + /// @return The Node pointer. + NodePtr NewFilesystemMgr::CreateAlias(const Char* path) + { + return node_cast(fImpl->CreateCatalog(path, 0, kNeFSCatalogKindAlias)); + } + + /// @brief Creates a node with is a page file. + /// @param path The filename path. + /// @return The Node pointer. + NodePtr NewFilesystemMgr::CreateSwapFile(const Char* path) + { + return node_cast(fImpl->CreateCatalog(path, 0, kNeFSCatalogKindPage)); + } + + /// @brief Gets the root directory. + /// @return + const Char* NewFilesystemHelper::Root() + { + return kNeFSRoot; + } + + /// @brief Gets the up-dir directory. + /// @return + const Char* NewFilesystemHelper::UpDir() + { + return kNeFSUpDir; + } + + /// @brief Gets the separator character. + /// @return + const Char NewFilesystemHelper::Separator() + { + return kNeFSSeparator; + } + + /// @brief Gets the metafile character. + /// @return + const Char NewFilesystemHelper::MetaFile() + { + return kNeFSMetaFilePrefix; + } +} // namespace Kernel + +#endif // ifdef __FSKIT_USE_NEFS__ |
