summaryrefslogtreecommitdiffhomepage
path: root/Source/FileManager.cxx
blob: 2a6648ce3148f0c1ccb701ffc0b60c12525cbfc0 (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
/*
 *	========================================================
 *
 *	hCore
 * 	Copyright 2024 Mahrouss Logic, all rights reserved.
 *
 * 	========================================================
 */

#include <KernelKit/FileManager.hpp>
#include <NewKit/ErrorID.hpp>
#include <NewKit/Utils.hpp>

//! @brief File manager for hCore.

namespace hCore
{
    static IFilesystemManager* kMounted = nullptr;
    
    /// @brief FilesystemManager getter.
    /// @return The mounted filesystem.
    IFilesystemManager* IFilesystemManager::GetMounted() { return kMounted; }

    IFilesystemManager* IFilesystemManager::Unmount()
    {
        if (kMounted)
        {
            auto mount = kMounted;
            kMounted = nullptr;

            return mount;
        }

        return nullptr;
    }

    bool IFilesystemManager::Mount(IFilesystemManager* pMount)
    {
        if (pMount)
        {
            kMounted = pMount;
            return true;
        }
        
        return false;
    }
}