summaryrefslogtreecommitdiff
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorGravatar bunnei2018-04-15 13:15:18 -0400
committerGravatar bunnei2018-04-15 13:15:18 -0400
commitbddad50dd400b31849fbd9486637fa9a2522cf58 (patch)
treef8e66493abf7fd870e6e98ed3d13b31e61a71b08 /src/core/file_sys
parentMerge pull request #333 from bunnei/const-buff-hints (diff)
downloadyuzu-bddad50dd400b31849fbd9486637fa9a2522cf58.tar.gz
yuzu-bddad50dd400b31849fbd9486637fa9a2522cf58.tar.xz
yuzu-bddad50dd400b31849fbd9486637fa9a2522cf58.zip
fsp_srv: Implement DeleteFile.
- Used by Binding of Isaac.
Diffstat (limited to 'src/core/file_sys')
-rw-r--r--src/core/file_sys/disk_filesystem.cpp12
-rw-r--r--src/core/file_sys/disk_filesystem.h2
-rw-r--r--src/core/file_sys/filesystem.h2
-rw-r--r--src/core/file_sys/romfs_filesystem.cpp2
-rw-r--r--src/core/file_sys/romfs_filesystem.h2
5 files changed, 12 insertions, 8 deletions
diff --git a/src/core/file_sys/disk_filesystem.cpp b/src/core/file_sys/disk_filesystem.cpp
index 4235f3935..263392930 100644
--- a/src/core/file_sys/disk_filesystem.cpp
+++ b/src/core/file_sys/disk_filesystem.cpp
@@ -57,10 +57,14 @@ ResultVal<std::unique_ptr<StorageBackend>> Disk_FileSystem::OpenFile(const std::
57 std::make_unique<Disk_Storage>(std::move(file))); 57 std::make_unique<Disk_Storage>(std::move(file)));
58} 58}
59 59
60ResultCode Disk_FileSystem::DeleteFile(const Path& path) const { 60ResultCode Disk_FileSystem::DeleteFile(const std::string& path) const {
61 LOG_WARNING(Service_FS, "(STUBBED) called"); 61 if (!FileUtil::Exists(path)) {
62 // TODO(bunnei): Use correct error code 62 return ERROR_PATH_NOT_FOUND;
63 return ResultCode(-1); 63 }
64
65 FileUtil::Delete(path);
66
67 return RESULT_SUCCESS;
64} 68}
65 69
66ResultCode Disk_FileSystem::RenameFile(const Path& src_path, const Path& dest_path) const { 70ResultCode Disk_FileSystem::RenameFile(const Path& src_path, const Path& dest_path) const {
diff --git a/src/core/file_sys/disk_filesystem.h b/src/core/file_sys/disk_filesystem.h
index 742d7db1a..05a29bc3a 100644
--- a/src/core/file_sys/disk_filesystem.h
+++ b/src/core/file_sys/disk_filesystem.h
@@ -25,7 +25,7 @@ public:
25 25
26 ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const std::string& path, 26 ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const std::string& path,
27 Mode mode) const override; 27 Mode mode) const override;
28 ResultCode DeleteFile(const Path& path) const override; 28 ResultCode DeleteFile(const std::string& path) const override;
29 ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override; 29 ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override;
30 ResultCode DeleteDirectory(const Path& path) const override; 30 ResultCode DeleteDirectory(const Path& path) const override;
31 ResultCode DeleteDirectoryRecursively(const Path& path) const override; 31 ResultCode DeleteDirectoryRecursively(const Path& path) const override;
diff --git a/src/core/file_sys/filesystem.h b/src/core/file_sys/filesystem.h
index 399427ca2..beefcfdb2 100644
--- a/src/core/file_sys/filesystem.h
+++ b/src/core/file_sys/filesystem.h
@@ -97,7 +97,7 @@ public:
97 * @param path Path relative to the archive 97 * @param path Path relative to the archive
98 * @return Result of the operation 98 * @return Result of the operation
99 */ 99 */
100 virtual ResultCode DeleteFile(const Path& path) const = 0; 100 virtual ResultCode DeleteFile(const std::string& path) const = 0;
101 101
102 /** 102 /**
103 * Create a directory specified by its path 103 * Create a directory specified by its path
diff --git a/src/core/file_sys/romfs_filesystem.cpp b/src/core/file_sys/romfs_filesystem.cpp
index 0c6cc3157..3d77e2d5f 100644
--- a/src/core/file_sys/romfs_filesystem.cpp
+++ b/src/core/file_sys/romfs_filesystem.cpp
@@ -20,7 +20,7 @@ ResultVal<std::unique_ptr<StorageBackend>> RomFS_FileSystem::OpenFile(const std:
20 std::make_unique<RomFS_Storage>(romfs_file, data_offset, data_size)); 20 std::make_unique<RomFS_Storage>(romfs_file, data_offset, data_size));
21} 21}
22 22
23ResultCode RomFS_FileSystem::DeleteFile(const Path& path) const { 23ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const {
24 LOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive (%s).", 24 LOG_CRITICAL(Service_FS, "Attempted to delete a file from an ROMFS archive (%s).",
25 GetName().c_str()); 25 GetName().c_str());
26 // TODO(bunnei): Use correct error code 26 // TODO(bunnei): Use correct error code
diff --git a/src/core/file_sys/romfs_filesystem.h b/src/core/file_sys/romfs_filesystem.h
index 3f94c04d0..1b5cac409 100644
--- a/src/core/file_sys/romfs_filesystem.h
+++ b/src/core/file_sys/romfs_filesystem.h
@@ -31,7 +31,7 @@ public:
31 31
32 ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const std::string& path, 32 ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const std::string& path,
33 Mode mode) const override; 33 Mode mode) const override;
34 ResultCode DeleteFile(const Path& path) const override; 34 ResultCode DeleteFile(const std::string& path) const override;
35 ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override; 35 ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override;
36 ResultCode DeleteDirectory(const Path& path) const override; 36 ResultCode DeleteDirectory(const Path& path) const override;
37 ResultCode DeleteDirectoryRecursively(const Path& path) const override; 37 ResultCode DeleteDirectoryRecursively(const Path& path) const override;