~aleteoryx/muditaos

muditaos/module-vfs/paths/filesystem_paths.cpp -rw-r--r-- 2.4 KiB
a405cad6Aleteoryx trim readme 6 days ago
                                                                                
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
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/blob/master/LICENSE.md

#include <purefs/filesystem_paths.hpp>

namespace
{
    constexpr auto PATH_SYSTEM      = "/system";
    constexpr auto PATH_USER        = "/user";
    constexpr auto PATH_CONF        = "/mfgconf";
    constexpr auto PATH_DB          = "db";
    constexpr auto PATH_LOGS        = "log";
    constexpr auto PATH_CRASH_DUMPS = "crash_dumps";
    constexpr auto PATH_USER_MEDIA  = "media";
    constexpr auto PATH_TMP         = "temp";
    constexpr auto PATH_ASSETS      = "assets";
    constexpr auto PATH_DATA        = "data";
    constexpr 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