summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar archshift2014-11-11 10:37:26 -0800
committerGravatar archshift2014-11-23 00:33:43 -0800
commit8aeadbd95a85e2d42d282897d7d286d645d61f27 (patch)
tree5cc15bf131a6cfb3e6a0834e07ca2d007f612a7e /src/core/file_sys
parentMerge pull request #192 from bunnei/fs-fix-paths (diff)
downloadyuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.tar.gz
yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.tar.xz
yuzu-8aeadbd95a85e2d42d282897d7d286d645d61f27.zip
Added DeleteFile and DeleteDirectory functions to FS:USER and the archives.
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/archive.h14
-rw-r--r--src/core/file_sys/archive_romfs.cpp20
-rw-r--r--src/core/file_sys/archive_romfs.h14
-rw-r--r--src/core/file_sys/archive_sdmc.cpp18
-rw-r--r--src/core/file_sys/archive_sdmc.h14
5 files changed, 80 insertions, 0 deletions
diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h
index dc2d2ced9..4cf47f30a 100644
--- a/src/core/file_sys/archive.h
+++ b/src/core/file_sys/archive.h
@@ -185,6 +185,20 @@ public:
185 virtual std::unique_ptr<File> OpenFile(const Path& 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 * Delete a file specified by its path
189 * @param path Path relative to the archive
190 * @return Whether the file could be deleted
191 */
192 virtual bool DeleteFile(const FileSys::Path& path) const = 0;
193
194 /**
195 * Delete a directory specified by its path
196 * @param path Path relative to the archive
197 * @return Whether the directory could be deleted
198 */
199 virtual bool DeleteDirectory(const FileSys::Path& path) const = 0;
200
201 /**
188 * Create a directory specified by its path 202 * Create a directory specified by its path
189 * @param path Path relative to the archive 203 * @param path Path relative to the archive
190 * @return Whether the directory could be created 204 * @return Whether the directory could be created
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp
index 3ea60134f..05fc1f87f 100644
--- a/src/core/file_sys/archive_romfs.cpp
+++ b/src/core/file_sys/archive_romfs.cpp
@@ -34,6 +34,26 @@ std::unique_ptr<File> Archive_RomFS::OpenFile(const Path& path, const Mode mode)
34} 34}
35 35
36/** 36/**
37 * Delete a file specified by its path
38 * @param path Path relative to the archive
39 * @return Whether the file could be deleted
40 */
41bool Archive_RomFS::DeleteFile(const FileSys::Path& path) const {
42 ERROR_LOG(FILESYS, "Attempted to delete a file from ROMFS.");
43 return false;
44}
45
46/**
47 * Delete a directory specified by its path
48 * @param path Path relative to the archive
49 * @return Whether the directory could be deleted
50 */
51bool Archive_RomFS::DeleteDirectory(const FileSys::Path& path) const {
52 ERROR_LOG(FILESYS, "Attempted to delete a directory from ROMFS.");
53 return false;
54}
55
56/**
37 * Create a directory specified by its path 57 * Create a directory specified by its path
38 * @param path Path relative to the archive 58 * @param path Path relative to the archive
39 * @return Whether the directory could be created 59 * @return Whether the directory could be created
diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h
index 8d5715734..aa6446c51 100644
--- a/src/core/file_sys/archive_romfs.h
+++ b/src/core/file_sys/archive_romfs.h
@@ -37,6 +37,20 @@ public:
37 std::unique_ptr<File> OpenFile(const Path& 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 * Delete a file specified by its path
41 * @param path Path relative to the archive
42 * @return Whether the file could be deleted
43 */
44 bool DeleteFile(const FileSys::Path& path) const override;
45
46 /**
47 * Delete a directory specified by its path
48 * @param path Path relative to the archive
49 * @return Whether the directory could be deleted
50 */
51 bool DeleteDirectory(const FileSys::Path& path) const override;
52
53 /**
40 * Create a directory specified by its path 54 * Create a directory specified by its path
41 * @param path Path relative to the archive 55 * @param path Path relative to the archive
42 * @return Whether the directory could be created 56 * @return Whether the directory could be created
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp
index ecdb7f211..c2ffcd40d 100644
--- a/src/core/file_sys/archive_sdmc.cpp
+++ b/src/core/file_sys/archive_sdmc.cpp
@@ -58,6 +58,24 @@ std::unique_ptr<File> Archive_SDMC::OpenFile(const Path& path, const Mode mode)
58} 58}
59 59
60/** 60/**
61 * Delete a file specified by its path
62 * @param path Path relative to the archive
63 * @return Whether the file could be deleted
64 */
65bool Archive_SDMC::DeleteFile(const FileSys::Path& path) const {
66 return FileUtil::Delete(GetMountPoint() + path.AsString());
67}
68
69/**
70 * Delete a directory specified by its path
71 * @param path Path relative to the archive
72 * @return Whether the directory could be deleted
73 */
74bool Archive_SDMC::DeleteDirectory(const FileSys::Path& path) const {
75 return FileUtil::DeleteDir(GetMountPoint() + path.AsString());
76}
77
78/**
61 * Create a directory specified by its path 79 * Create a directory specified by its path
62 * @param path Path relative to the archive 80 * @param path Path relative to the archive
63 * @return Whether the directory could be created 81 * @return Whether the directory could be created
diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h
index 1f621b3f7..8ac06484c 100644
--- a/src/core/file_sys/archive_sdmc.h
+++ b/src/core/file_sys/archive_sdmc.h
@@ -41,6 +41,20 @@ public:
41 std::unique_ptr<File> OpenFile(const Path& 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 * Delete a file specified by its path
45 * @param path Path relative to the archive
46 * @return Whether the file could be deleted
47 */
48 bool DeleteFile(const FileSys::Path& path) const override;
49
50 /**
51 * Delete a directory specified by its path
52 * @param path Path relative to the archive
53 * @return Whether the directory could be deleted
54 */
55 bool DeleteDirectory(const FileSys::Path& path) const override;
56
57 /**
44 * Create a directory specified by its path 58 * Create a directory specified by its path
45 * @param path Path relative to the archive 59 * @param path Path relative to the archive
46 * @return Whether the directory could be created 60 * @return Whether the directory could be created