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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <purefs/filesystem_paths.hpp>
namespace
{
constexpr inline auto PATH_SYSTEM = "/system";
constexpr inline auto PATH_USER = "/user";
constexpr inline auto PATH_CONF = "/mfgconf";
constexpr inline auto PATH_DB = "db";
constexpr inline auto PATH_LOGS = "log";
constexpr inline auto PATH_CRASH_DUMPS = "crash_dumps";
constexpr inline auto PATH_USER_MEDIA =
"media"; // TODO this won't work with our current non-hierarchical MTP implementation
constexpr inline auto PATH_TMP = "temp";
constexpr inline auto PATH_ASSETS = "assets";
constexpr inline auto PATH_DATA = "data";
constexpr inline auto PATH_VAR = "var";
} // namespace
namespace purefs
{
namespace dir
{
std::filesystem::path getSystemDiskPath() noexcept
{
return std::filesystem::path{PATH_SYSTEM};
}
std::filesystem::path getUserDiskPath() noexcept
{
return std::filesystem::path{PATH_USER};
}
std::filesystem::path getMfgConfPath() noexcept
{
return std::filesystem::path{PATH_CONF};
}
std::filesystem::path getDatabasesPath() noexcept
{
return getSystemDiskPath() / PATH_DB;
}
std::filesystem::path getLogsPath() noexcept
{
return getSystemDiskPath() / PATH_LOGS;
}
std::filesystem::path getCrashDumpsPath() noexcept
{
return getSystemDiskPath() / PATH_CRASH_DUMPS;
}
std::filesystem::path getUserMediaPath() noexcept
{
return getUserDiskPath() / PATH_USER_MEDIA;
}
std::filesystem::path getTemporaryPath() noexcept
{
return getUserDiskPath() / PATH_TMP;
}
std::filesystem::path getBootJSONPath() noexcept
{
return getUserDiskPath() / file::boot_json;
}
std::filesystem::path getAssetsDirPath() noexcept
{
return getSystemDiskPath() / PATH_ASSETS;
}
std::filesystem::path getSystemDataDirPath() noexcept
{
return getSystemDiskPath() / PATH_DATA;
}
std::filesystem::path getSystemVarDirPath() noexcept
{
return getSystemDiskPath() / PATH_VAR;
}
} // namespace dir
} // namespace purefs