summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/directory.h
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-08-08 23:49:57 +0200
committerLioncash <mathew1800@gmail.com>2018-08-09 00:51:52 +0200
commit7353cfc7813c960e7fdb0b33829865c606f98c84 (patch)
tree65c5bc3a27c0df3229145afb2552993ba72a46be /src/core/file_sys/directory.h
parentfsp_srv: Emplace entries first when building index instead of emplacing last (diff)
downloadyuzu-7353cfc7813c960e7fdb0b33829865c606f98c84.tar
yuzu-7353cfc7813c960e7fdb0b33829865c606f98c84.tar.gz
yuzu-7353cfc7813c960e7fdb0b33829865c606f98c84.tar.bz2
yuzu-7353cfc7813c960e7fdb0b33829865c606f98c84.tar.lz
yuzu-7353cfc7813c960e7fdb0b33829865c606f98c84.tar.xz
yuzu-7353cfc7813c960e7fdb0b33829865c606f98c84.tar.zst
yuzu-7353cfc7813c960e7fdb0b33829865c606f98c84.zip
Diffstat (limited to 'src/core/file_sys/directory.h')
-rw-r--r--src/core/file_sys/directory.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/file_sys/directory.h b/src/core/file_sys/directory.h
index 213ce1826..3759e743a 100644
--- a/src/core/file_sys/directory.h
+++ b/src/core/file_sys/directory.h
@@ -4,8 +4,9 @@
#pragma once
-#include <array>
#include <cstddef>
+#include <iterator>
+#include <string_view>
#include "common/common_funcs.h"
#include "common/common_types.h"
@@ -21,9 +22,14 @@ enum EntryType : u8 {
// Structure of a directory entry, from
// http://switchbrew.org/index.php?title=Filesystem_services#DirectoryEntry
-const size_t FILENAME_LENGTH = 0x300;
struct Entry {
- char filename[FILENAME_LENGTH];
+ Entry(std::string_view view, EntryType entry_type, u64 entry_size)
+ : type{entry_type}, file_size{entry_size} {
+ const size_t copy_size = view.copy(filename, std::size(filename) - 1);
+ filename[copy_size] = '\0';
+ }
+
+ char filename[0x300];
INSERT_PADDING_BYTES(4);
EntryType type;
INSERT_PADDING_BYTES(3);