summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/NewFS+FileManager.cxx
blob: 171f0c6fdd8bd60263406bbc0d6a328341867c29 (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
/* -------------------------------------------

    Copyright Mahrouss Logic

------------------------------------------- */

#include <KernelKit/FileManager.hpp>

#ifdef __FSKIT_NEWFS__

/// @brief NewFS File manager.
/// BUGS: 0

namespace NewOS {
NewFilesystemManager::NewFilesystemManager() = default;

NewFilesystemManager::~NewFilesystemManager() = default;

bool NewFilesystemManager::Remove(const char* node_name) {
  if (node_name == nullptr || *node_name == 0) return false;

  if (auto catalog = fImpl->GetCatalog(node_name); catalog)
    return fImpl->RemoveCatalog(catalog);

  return false;
}

NodePtr NewFilesystemManager::Create(const char* path) {
  return node_cast(fImpl->CreateCatalog(path, 0, kNewFSCatalogKindFile));
}

NodePtr NewFilesystemManager::CreateDirectory(const char* path) {
  return node_cast(fImpl->CreateCatalog(path, 0, kNewFSCatalogKindDir));
}

NodePtr NewFilesystemManager::CreateAlias(const char* path) {
  return node_cast(fImpl->CreateCatalog(path, 0, kNewFSCatalogKindAlias));
}

const char* NewFilesystemHelper::Root() { return kNewFSRoot; }

const char* NewFilesystemHelper::UpDir() { return kNewFSUpDir; }

const char NewFilesystemHelper::Separator() { return kNewFSSeparator; }
}  // namespace NewOS

#endif  // ifdef __FSKIT_NEWFS__