diff options
author | FearlessTobi <thm.frey@gmail.com> | 2024-02-10 20:58:43 +0100 |
---|---|---|
committer | FearlessTobi <thm.frey@gmail.com> | 2024-02-19 19:20:46 +0100 |
commit | 934e420e36e817c673a839e2a417785906bfe91c (patch) | |
tree | 13777628e911468f88ed928d0bfa6f4a3d416f10 /src/core/file_sys/fssrv | |
parent | fs: Add FileSystemAccessor classes (diff) | |
download | yuzu-934e420e36e817c673a839e2a417785906bfe91c.tar yuzu-934e420e36e817c673a839e2a417785906bfe91c.tar.gz yuzu-934e420e36e817c673a839e2a417785906bfe91c.tar.bz2 yuzu-934e420e36e817c673a839e2a417785906bfe91c.tar.lz yuzu-934e420e36e817c673a839e2a417785906bfe91c.tar.xz yuzu-934e420e36e817c673a839e2a417785906bfe91c.tar.zst yuzu-934e420e36e817c673a839e2a417785906bfe91c.zip |
Diffstat (limited to '')
-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 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "core/file_sys/fs_directory.h" + +namespace FileSys::Sf { + +struct Path { + char str[EntryNameLengthMax + 1]; + + static constexpr Path Encode(const char* p) { + Path path = {}; + for (size_t i = 0; i < sizeof(path) - 1; i++) { + path.str[i] = p[i]; + if (p[i] == '\x00') { + break; + } + } + return path; + } + + static constexpr size_t GetPathLength(const Path& path) { + size_t len = 0; + for (size_t i = 0; i < sizeof(path) - 1 && path.str[i] != '\x00'; i++) { + len++; + } + return len; + } +}; +static_assert(std::is_trivially_copyable_v<Path>, "Path must be trivially copyable."); + +using FspPath = Path; + +} // namespace FileSys::Sf
\ No newline at end of file |