summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/NewFS.cxx
blob: 28e102fd113e8a35a398d16c1cf973e832dc538c (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
/*
 *	========================================================
 *
 *	HCore
 * 	Copyright Mahrouss Logic, all rights reserved.
 *
 * 	========================================================
 */

#include <FSKit/NewFS.hxx>
#include <KernelKit/FileManager.hpp>

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

NewFilesystemManager::~NewFilesystemManager() = default;

/**
 * Unallocates a file from disk.
 * @param node_name it's path.
 * @return operation status boolean.
 */
bool NewFilesystemManager::Remove(const char* node_name) {
  if (node_name == nullptr || *node_name == 0) return false;

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

  return false;
}

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

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

NodePtr NewFilesystemManager::CreateAlias(const char* path) {
  return node_cast(fIO->CreateCatalog(path, 0, kCatalogKindAlias));
}
}  // namespace HCore