blob: 27f1db9c3b7592cbb4a8488d38f2e5735b97a450 (
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
|
#include "filesystem/vfs.hpp"
#include "kapi/system.hpp"
#include <optional>
namespace filesystem
{
namespace
{
constinit auto static active_vfs = std::optional<vfs>{};
}
auto vfs::init() -> void
{
if (active_vfs)
{
kapi::system::panic("[FILESYSTEM] vfs has already been initialized.");
}
active_vfs.emplace(vfs{});
}
auto vfs::get() -> vfs &
{
if (!active_vfs)
{
kapi::system::panic("[FILESYSTEM] vfs has not been initialized.");
}
return *active_vfs;
}
} // namespace filesystem
|