diff options
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/fssrv/fssrv_sf_path.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/core/file_sys/fssrv/fssrv_sf_path.h b/src/core/file_sys/fssrv/fssrv_sf_path.h new file mode 100644 index 000000000..1752a413d --- /dev/null +++ b/src/core/file_sys/fssrv/fssrv_sf_path.h | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "core/file_sys/fs_directory.h" | ||
| 7 | |||
| 8 | namespace FileSys::Sf { | ||
| 9 | |||
| 10 | struct Path { | ||
| 11 | char str[EntryNameLengthMax + 1]; | ||
| 12 | |||
| 13 | static constexpr Path Encode(const char* p) { | ||
| 14 | Path path = {}; | ||
| 15 | for (size_t i = 0; i < sizeof(path) - 1; i++) { | ||
| 16 | path.str[i] = p[i]; | ||
| 17 | if (p[i] == '\x00') { | ||
| 18 | break; | ||
| 19 | } | ||
| 20 | } | ||
| 21 | return path; | ||
| 22 | } | ||
| 23 | |||
| 24 | static constexpr size_t GetPathLength(const Path& path) { | ||
| 25 | size_t len = 0; | ||
| 26 | for (size_t i = 0; i < sizeof(path) - 1 && path.str[i] != '\x00'; i++) { | ||
| 27 | len++; | ||
| 28 | } | ||
| 29 | return len; | ||
| 30 | } | ||
| 31 | }; | ||
| 32 | static_assert(std::is_trivially_copyable_v<Path>, "Path must be trivially copyable."); | ||
| 33 | |||
| 34 | using FspPath = Path; | ||
| 35 | |||
| 36 | } // namespace FileSys::Sf \ No newline at end of file | ||