summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/file_sys/archive.h6
-rw-r--r--src/core/file_sys/archive_romfs.cpp6
-rw-r--r--src/core/file_sys/archive_romfs.h6
-rw-r--r--src/core/file_sys/archive_sdmc.cpp12
-rw-r--r--src/core/file_sys/archive_sdmc.h6
-rw-r--r--src/core/file_sys/directory_sdmc.cpp4
-rw-r--r--src/core/file_sys/directory_sdmc.h2
-rw-r--r--src/core/file_sys/file_sdmc.cpp4
-rw-r--r--src/core/file_sys/file_sdmc.h2
-rw-r--r--src/core/hle/kernel/archive.cpp14
-rw-r--r--src/core/hle/kernel/archive.h6
-rw-r--r--src/core/hle/service/fs_user.cpp8
12 files changed, 38 insertions, 38 deletions
diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h
index 7b3130f16..dc2d2ced9 100644
--- a/src/core/file_sys/archive.h
+++ b/src/core/file_sys/archive.h
@@ -182,21 +182,21 @@ public:
182 * @param mode Mode to open the file with 182 * @param mode Mode to open the file with
183 * @return Opened file, or nullptr 183 * @return Opened file, or nullptr
184 */ 184 */
185 virtual std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const = 0; 185 virtual std::unique_ptr<File> OpenFile(const Path& path, const Mode mode) const = 0;
186 186
187 /** 187 /**
188 * Create a directory specified by its path 188 * Create a directory specified by its path
189 * @param path Path relative to the archive 189 * @param path Path relative to the archive
190 * @return Whether the directory could be created 190 * @return Whether the directory could be created
191 */ 191 */
192 virtual bool CreateDirectory(const std::string& path) const = 0; 192 virtual bool CreateDirectory(const Path& path) const = 0;
193 193
194 /** 194 /**
195 * Open a directory specified by its path 195 * Open a directory specified by its path
196 * @param path Path relative to the archive 196 * @param path Path relative to the archive
197 * @return Opened directory, or nullptr 197 * @return Opened directory, or nullptr
198 */ 198 */
199 virtual std::unique_ptr<Directory> OpenDirectory(const std::string& path) const = 0; 199 virtual std::unique_ptr<Directory> OpenDirectory(const Path& path) const = 0;
200 200
201 /** 201 /**
202 * Read data from the archive 202 * Read data from the archive
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp
index cc759faa8..3ea60134f 100644
--- a/src/core/file_sys/archive_romfs.cpp
+++ b/src/core/file_sys/archive_romfs.cpp
@@ -29,7 +29,7 @@ Archive_RomFS::~Archive_RomFS() {
29 * @param mode Mode to open the file with 29 * @param mode Mode to open the file with
30 * @return Opened file, or nullptr 30 * @return Opened file, or nullptr
31 */ 31 */
32std::unique_ptr<File> Archive_RomFS::OpenFile(const std::string& path, const Mode mode) const { 32std::unique_ptr<File> Archive_RomFS::OpenFile(const Path& path, const Mode mode) const {
33 return std::unique_ptr<File>(new File_RomFS); 33 return std::unique_ptr<File>(new File_RomFS);
34} 34}
35 35
@@ -38,7 +38,7 @@ std::unique_ptr<File> Archive_RomFS::OpenFile(const std::string& path, const Mod
38 * @param path Path relative to the archive 38 * @param path Path relative to the archive
39 * @return Whether the directory could be created 39 * @return Whether the directory could be created
40 */ 40 */
41bool Archive_RomFS::CreateDirectory(const std::string& path) const { 41bool Archive_RomFS::CreateDirectory(const Path& path) const {
42 ERROR_LOG(FILESYS, "Attempted to create a directory in ROMFS."); 42 ERROR_LOG(FILESYS, "Attempted to create a directory in ROMFS.");
43 return false; 43 return false;
44}; 44};
@@ -48,7 +48,7 @@ bool Archive_RomFS::CreateDirectory(const std::string& path) const {
48 * @param path Path relative to the archive 48 * @param path Path relative to the archive
49 * @return Opened directory, or nullptr 49 * @return Opened directory, or nullptr
50 */ 50 */
51std::unique_ptr<Directory> Archive_RomFS::OpenDirectory(const std::string& path) const { 51std::unique_ptr<Directory> Archive_RomFS::OpenDirectory(const Path& path) const {
52 return std::unique_ptr<Directory>(new Directory_RomFS); 52 return std::unique_ptr<Directory>(new Directory_RomFS);
53} 53}
54 54
diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h
index ae2344e82..8d5715734 100644
--- a/src/core/file_sys/archive_romfs.h
+++ b/src/core/file_sys/archive_romfs.h
@@ -34,21 +34,21 @@ public:
34 * @param mode Mode to open the file with 34 * @param mode Mode to open the file with
35 * @return Opened file, or nullptr 35 * @return Opened file, or nullptr
36 */ 36 */
37 std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const override; 37 std::unique_ptr<File> OpenFile(const Path& path, const Mode mode) const override;
38 38
39 /** 39 /**
40 * Create a directory specified by its path 40 * Create a directory specified by its path
41 * @param path Path relative to the archive 41 * @param path Path relative to the archive
42 * @return Whether the directory could be created 42 * @return Whether the directory could be created
43 */ 43 */
44 bool CreateDirectory(const std::string& path) const override; 44 bool CreateDirectory(const Path& path) const override;
45 45
46 /** 46 /**
47 * Open a directory specified by its path 47 * Open a directory specified by its path
48 * @param path Path relative to the archive 48 * @param path Path relative to the archive
49 * @return Opened directory, or nullptr 49 * @return Opened directory, or nullptr
50 */ 50 */
51 std::unique_ptr<Directory> OpenDirectory(const std::string& path) const override; 51 std::unique_ptr<Directory> OpenDirectory(const Path& path) const override;
52 52
53 /** 53 /**
54 * Read data from the archive 54 * Read data from the archive
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp
index 66931e93e..ecdb7f211 100644
--- a/src/core/file_sys/archive_sdmc.cpp
+++ b/src/core/file_sys/archive_sdmc.cpp
@@ -49,8 +49,8 @@ bool Archive_SDMC::Initialize() {
49 * @param mode Mode to open the file with 49 * @param mode Mode to open the file with
50 * @return Opened file, or nullptr 50 * @return Opened file, or nullptr
51 */ 51 */
52std::unique_ptr<File> Archive_SDMC::OpenFile(const std::string& path, const Mode mode) const { 52std::unique_ptr<File> Archive_SDMC::OpenFile(const Path& path, const Mode mode) const {
53 DEBUG_LOG(FILESYS, "called path=%s mode=%d", path.c_str(), mode); 53 DEBUG_LOG(FILESYS, "called path=%s mode=%d", path.DebugStr().c_str(), mode);
54 File_SDMC* file = new File_SDMC(this, path, mode); 54 File_SDMC* file = new File_SDMC(this, path, mode);
55 if (!file->Open()) 55 if (!file->Open())
56 return nullptr; 56 return nullptr;
@@ -62,8 +62,8 @@ std::unique_ptr<File> Archive_SDMC::OpenFile(const std::string& path, const Mode
62 * @param path Path relative to the archive 62 * @param path Path relative to the archive
63 * @return Whether the directory could be created 63 * @return Whether the directory could be created
64 */ 64 */
65bool Archive_SDMC::CreateDirectory(const std::string& path) const { 65bool Archive_SDMC::CreateDirectory(const Path& path) const {
66 return FileUtil::CreateDir(GetMountPoint() + path); 66 return FileUtil::CreateDir(GetMountPoint() + path.AsString());
67} 67}
68 68
69/** 69/**
@@ -71,8 +71,8 @@ bool Archive_SDMC::CreateDirectory(const std::string& path) const {
71 * @param path Path relative to the archive 71 * @param path Path relative to the archive
72 * @return Opened directory, or nullptr 72 * @return Opened directory, or nullptr
73 */ 73 */
74std::unique_ptr<Directory> Archive_SDMC::OpenDirectory(const std::string& path) const { 74std::unique_ptr<Directory> Archive_SDMC::OpenDirectory(const Path& path) const {
75 DEBUG_LOG(FILESYS, "called path=%s", path.c_str()); 75 DEBUG_LOG(FILESYS, "called path=%s", path.DebugStr().c_str());
76 Directory_SDMC* directory = new Directory_SDMC(this, path); 76 Directory_SDMC* directory = new Directory_SDMC(this, path);
77 return std::unique_ptr<Directory>(directory); 77 return std::unique_ptr<Directory>(directory);
78} 78}
diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h
index 0e059b635..1f621b3f7 100644
--- a/src/core/file_sys/archive_sdmc.h
+++ b/src/core/file_sys/archive_sdmc.h
@@ -38,21 +38,21 @@ public:
38 * @param mode Mode to open the file with 38 * @param mode Mode to open the file with
39 * @return Opened file, or nullptr 39 * @return Opened file, or nullptr
40 */ 40 */
41 std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const override; 41 std::unique_ptr<File> OpenFile(const Path& path, const Mode mode) const override;
42 42
43 /** 43 /**
44 * Create a directory specified by its path 44 * Create a directory specified by its path
45 * @param path Path relative to the archive 45 * @param path Path relative to the archive
46 * @return Whether the directory could be created 46 * @return Whether the directory could be created
47 */ 47 */
48 bool CreateDirectory(const std::string& path) const override; 48 bool CreateDirectory(const Path& path) const override;
49 49
50 /** 50 /**
51 * Open a directory specified by its path 51 * Open a directory specified by its path
52 * @param path Path relative to the archive 52 * @param path Path relative to the archive
53 * @return Opened directory, or nullptr 53 * @return Opened directory, or nullptr
54 */ 54 */
55 std::unique_ptr<Directory> OpenDirectory(const std::string& path) const override; 55 std::unique_ptr<Directory> OpenDirectory(const Path& path) const override;
56 56
57 /** 57 /**
58 * Read data from the archive 58 * Read data from the archive
diff --git a/src/core/file_sys/directory_sdmc.cpp b/src/core/file_sys/directory_sdmc.cpp
index fd558def9..923ca6862 100644
--- a/src/core/file_sys/directory_sdmc.cpp
+++ b/src/core/file_sys/directory_sdmc.cpp
@@ -15,11 +15,11 @@
15 15
16namespace FileSys { 16namespace FileSys {
17 17
18Directory_SDMC::Directory_SDMC(const Archive_SDMC* archive, const std::string& path) { 18Directory_SDMC::Directory_SDMC(const Archive_SDMC* archive, const Path& path) {
19 // TODO(Link Mauve): normalize path into an absolute path without "..", it can currently bypass 19 // TODO(Link Mauve): normalize path into an absolute path without "..", it can currently bypass
20 // the root directory we set while opening the archive. 20 // the root directory we set while opening the archive.
21 // For example, opening /../../usr/bin can give the emulated program your installed programs. 21 // For example, opening /../../usr/bin can give the emulated program your installed programs.
22 std::string absolute_path = archive->GetMountPoint() + path; 22 std::string absolute_path = archive->GetMountPoint() + path.AsString();
23 FileUtil::ScanDirectoryTree(absolute_path, directory); 23 FileUtil::ScanDirectoryTree(absolute_path, directory);
24 children_iterator = directory.children.begin(); 24 children_iterator = directory.children.begin();
25} 25}
diff --git a/src/core/file_sys/directory_sdmc.h b/src/core/file_sys/directory_sdmc.h
index cb8d32fda..4520d0401 100644
--- a/src/core/file_sys/directory_sdmc.h
+++ b/src/core/file_sys/directory_sdmc.h
@@ -19,7 +19,7 @@ namespace FileSys {
19class Directory_SDMC final : public Directory { 19class Directory_SDMC final : public Directory {
20public: 20public:
21 Directory_SDMC(); 21 Directory_SDMC();
22 Directory_SDMC(const Archive_SDMC* archive, const std::string& path); 22 Directory_SDMC(const Archive_SDMC* archive, const Path& path);
23 ~Directory_SDMC() override; 23 ~Directory_SDMC() override;
24 24
25 /** 25 /**
diff --git a/src/core/file_sys/file_sdmc.cpp b/src/core/file_sys/file_sdmc.cpp
index 26204392c..a4b90670a 100644
--- a/src/core/file_sys/file_sdmc.cpp
+++ b/src/core/file_sys/file_sdmc.cpp
@@ -15,11 +15,11 @@
15 15
16namespace FileSys { 16namespace FileSys {
17 17
18File_SDMC::File_SDMC(const Archive_SDMC* archive, const std::string& path, const Mode mode) { 18File_SDMC::File_SDMC(const Archive_SDMC* archive, const Path& path, const Mode mode) {
19 // TODO(Link Mauve): normalize path into an absolute path without "..", it can currently bypass 19 // TODO(Link Mauve): normalize path into an absolute path without "..", it can currently bypass
20 // the root directory we set while opening the archive. 20 // the root directory we set while opening the archive.
21 // For example, opening /../../etc/passwd can give the emulated program your users list. 21 // For example, opening /../../etc/passwd can give the emulated program your users list.
22 this->path = archive->GetMountPoint() + path; 22 this->path = archive->GetMountPoint() + path.AsString();
23 this->mode.hex = mode.hex; 23 this->mode.hex = mode.hex;
24} 24}
25 25
diff --git a/src/core/file_sys/file_sdmc.h b/src/core/file_sys/file_sdmc.h
index df032f7c0..80b445968 100644
--- a/src/core/file_sys/file_sdmc.h
+++ b/src/core/file_sys/file_sdmc.h
@@ -19,7 +19,7 @@ namespace FileSys {
19class File_SDMC final : public File { 19class File_SDMC final : public File {
20public: 20public:
21 File_SDMC(); 21 File_SDMC();
22 File_SDMC(const Archive_SDMC* archive, const std::string& path, const Mode mode); 22 File_SDMC(const Archive_SDMC* archive, const Path& path, const Mode mode);
23 ~File_SDMC() override; 23 ~File_SDMC() override;
24 24
25 /** 25 /**
diff --git a/src/core/hle/kernel/archive.cpp b/src/core/hle/kernel/archive.cpp
index 764082d71..5d734d042 100644
--- a/src/core/hle/kernel/archive.cpp
+++ b/src/core/hle/kernel/archive.cpp
@@ -129,12 +129,12 @@ public:
129class File : public Object { 129class File : public Object {
130public: 130public:
131 std::string GetTypeName() const override { return "File"; } 131 std::string GetTypeName() const override { return "File"; }
132 std::string GetName() const override { return path; } 132 std::string GetName() const override { return path.DebugStr(); }
133 133
134 static Kernel::HandleType GetStaticHandleType() { return HandleType::File; } 134 static Kernel::HandleType GetStaticHandleType() { return HandleType::File; }
135 Kernel::HandleType GetHandleType() const override { return HandleType::File; } 135 Kernel::HandleType GetHandleType() const override { return HandleType::File; }
136 136
137 std::string path; ///< Path of the file 137 FileSys::Path path; ///< Path of the file
138 std::unique_ptr<FileSys::File> backend; ///< File backend interface 138 std::unique_ptr<FileSys::File> backend; ///< File backend interface
139 139
140 /** 140 /**
@@ -221,12 +221,12 @@ public:
221class Directory : public Object { 221class Directory : public Object {
222public: 222public:
223 std::string GetTypeName() const override { return "Directory"; } 223 std::string GetTypeName() const override { return "Directory"; }
224 std::string GetName() const override { return path; } 224 std::string GetName() const override { return path.DebugStr(); }
225 225
226 static Kernel::HandleType GetStaticHandleType() { return HandleType::Directory; } 226 static Kernel::HandleType GetStaticHandleType() { return HandleType::Directory; }
227 Kernel::HandleType GetHandleType() const override { return HandleType::Directory; } 227 Kernel::HandleType GetHandleType() const override { return HandleType::Directory; }
228 228
229 std::string path; ///< Path of the directory 229 FileSys::Path path; ///< Path of the directory
230 std::unique_ptr<FileSys::Directory> backend; ///< File backend interface 230 std::unique_ptr<FileSys::Directory> backend; ///< File backend interface
231 231
232 /** 232 /**
@@ -366,7 +366,7 @@ Handle CreateArchive(FileSys::Archive* backend, const std::string& name) {
366 * @param mode Mode under which to open the File 366 * @param mode Mode under which to open the File
367 * @return Opened File object 367 * @return Opened File object
368 */ 368 */
369Handle OpenFileFromArchive(Handle archive_handle, const std::string& path, const FileSys::Mode mode) { 369Handle OpenFileFromArchive(Handle archive_handle, const FileSys::Path& path, const FileSys::Mode mode) {
370 File* file = new File; 370 File* file = new File;
371 Handle handle = Kernel::g_object_pool.Create(file); 371 Handle handle = Kernel::g_object_pool.Create(file);
372 372
@@ -386,7 +386,7 @@ Handle OpenFileFromArchive(Handle archive_handle, const std::string& path, const
386 * @param path Path to the Directory inside of the Archive 386 * @param path Path to the Directory inside of the Archive
387 * @return Opened Directory object 387 * @return Opened Directory object
388 */ 388 */
389Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& path) { 389Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
390 Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle); 390 Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
391 if (archive == nullptr) 391 if (archive == nullptr)
392 return -1; 392 return -1;
@@ -401,7 +401,7 @@ Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& path
401 * @param path Path to the Directory inside of the Archive 401 * @param path Path to the Directory inside of the Archive
402 * @return Opened Directory object 402 * @return Opened Directory object
403 */ 403 */
404Handle OpenDirectoryFromArchive(Handle archive_handle, const std::string& path) { 404Handle OpenDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
405 Directory* directory = new Directory; 405 Directory* directory = new Directory;
406 Handle handle = Kernel::g_object_pool.Create(directory); 406 Handle handle = Kernel::g_object_pool.Create(directory);
407 407
diff --git a/src/core/hle/kernel/archive.h b/src/core/hle/kernel/archive.h
index 0230996b6..9c6015506 100644
--- a/src/core/hle/kernel/archive.h
+++ b/src/core/hle/kernel/archive.h
@@ -43,7 +43,7 @@ Handle CreateArchive(FileSys::Archive* backend, const std::string& name);
43 * @param mode Mode under which to open the File 43 * @param mode Mode under which to open the File
44 * @return Opened File object 44 * @return Opened File object
45 */ 45 */
46Handle OpenFileFromArchive(Handle archive_handle, const std::string& name, const FileSys::Mode mode); 46Handle OpenFileFromArchive(Handle archive_handle, const FileSys::Path& path, const FileSys::Mode mode);
47 47
48/** 48/**
49 * Create a Directory from an Archive 49 * Create a Directory from an Archive
@@ -51,7 +51,7 @@ Handle OpenFileFromArchive(Handle archive_handle, const std::string& name, const
51 * @param path Path to the Directory inside of the Archive 51 * @param path Path to the Directory inside of the Archive
52 * @return Whether creation of directory succeeded 52 * @return Whether creation of directory succeeded
53 */ 53 */
54Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& name); 54Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
55 55
56/** 56/**
57 * Open a Directory from an Archive 57 * Open a Directory from an Archive
@@ -59,7 +59,7 @@ Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& name
59 * @param path Path to the Directory inside of the Archive 59 * @param path Path to the Directory inside of the Archive
60 * @return Opened Directory object 60 * @return Opened Directory object
61 */ 61 */
62Handle OpenDirectoryFromArchive(Handle archive_handle, const std::string& name); 62Handle OpenDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
63 63
64/// Initialize archives 64/// Initialize archives
65void ArchiveInit(); 65void ArchiveInit();
diff --git a/src/core/hle/service/fs_user.cpp b/src/core/hle/service/fs_user.cpp
index 9dc83291d..1548b9ee5 100644
--- a/src/core/hle/service/fs_user.cpp
+++ b/src/core/hle/service/fs_user.cpp
@@ -55,7 +55,7 @@ void OpenFile(Service::Interface* self) {
55 DEBUG_LOG(KERNEL, "type=%d size=%d mode=%d attrs=%d data=%s", 55 DEBUG_LOG(KERNEL, "type=%d size=%d mode=%d attrs=%d data=%s",
56 filename_type, filename_size, mode, attributes, file_string.c_str()); 56 filename_type, filename_size, mode, attributes, file_string.c_str());
57 57
58 Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_string, mode); 58 Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_path, mode);
59 if (handle) { 59 if (handle) {
60 cmd_buff[1] = 0; 60 cmd_buff[1] = 0;
61 cmd_buff[3] = handle; 61 cmd_buff[3] = handle;
@@ -115,7 +115,7 @@ void OpenFileDirectly(Service::Interface* self) {
115 return; 115 return;
116 } 116 }
117 117
118 Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_string, mode); 118 Handle handle = Kernel::OpenFileFromArchive(archive_handle, file_path, mode);
119 if (handle) { 119 if (handle) {
120 cmd_buff[1] = 0; 120 cmd_buff[1] = 0;
121 cmd_buff[3] = handle; 121 cmd_buff[3] = handle;
@@ -163,7 +163,7 @@ void CreateDirectory(Service::Interface* self) {
163 163
164 DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_string.c_str()); 164 DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_string.c_str());
165 165
166 cmd_buff[1] = Kernel::CreateDirectoryFromArchive(archive_handle, dir_string); 166 cmd_buff[1] = Kernel::CreateDirectoryFromArchive(archive_handle, dir_path);
167 167
168 DEBUG_LOG(KERNEL, "called"); 168 DEBUG_LOG(KERNEL, "called");
169} 169}
@@ -192,7 +192,7 @@ void OpenDirectory(Service::Interface* self) {
192 192
193 DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_string.c_str()); 193 DEBUG_LOG(KERNEL, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_string.c_str());
194 194
195 Handle handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_string); 195 Handle handle = Kernel::OpenDirectoryFromArchive(archive_handle, dir_path);
196 if (handle) { 196 if (handle) {
197 cmd_buff[1] = 0; 197 cmd_buff[1] = 0;
198 cmd_buff[3] = handle; 198 cmd_buff[3] = handle;