diff options
author | mailwl <mailwl@gmail.com> | 2018-04-24 09:56:05 +0200 |
---|---|---|
committer | mailwl <mailwl@gmail.com> | 2018-04-24 09:56:05 +0200 |
commit | a0179e5ca5bc54491f03ff60d2f971197eb03e88 (patch) | |
tree | 99ba0561c6fe429169a40e76a70db7b3f99a71ee /src/core/file_sys | |
parent | Merge pull request #379 from Subv/multi_buffers (diff) | |
download | yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar.gz yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar.bz2 yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar.lz yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar.xz yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.tar.zst yuzu-a0179e5ca5bc54491f03ff60d2f971197eb03e88.zip |
Diffstat (limited to 'src/core/file_sys')
-rw-r--r-- | src/core/file_sys/disk_filesystem.cpp | 12 | ||||
-rw-r--r-- | src/core/file_sys/disk_filesystem.h | 2 | ||||
-rw-r--r-- | src/core/file_sys/filesystem.h | 3 | ||||
-rw-r--r-- | src/core/file_sys/romfs_filesystem.cpp | 3 | ||||
-rw-r--r-- | src/core/file_sys/romfs_filesystem.h | 2 |
5 files changed, 15 insertions, 7 deletions
diff --git a/src/core/file_sys/disk_filesystem.cpp b/src/core/file_sys/disk_filesystem.cpp index ca1323873..4d00249fa 100644 --- a/src/core/file_sys/disk_filesystem.cpp +++ b/src/core/file_sys/disk_filesystem.cpp @@ -67,10 +67,16 @@ ResultCode Disk_FileSystem::DeleteFile(const std::string& path) const { return RESULT_SUCCESS; } -ResultCode Disk_FileSystem::RenameFile(const Path& src_path, const Path& dest_path) const { - LOG_WARNING(Service_FS, "(STUBBED) called"); +ResultCode Disk_FileSystem::RenameFile(const std::string& src_path, + const std::string& dest_path) const { + const std::string full_src_path = base_directory + src_path; + const std::string full_dest_path = base_directory + dest_path; + + if (!FileUtil::Exists(full_src_path)) { + return ERROR_PATH_NOT_FOUND; + } // TODO(wwylele): Use correct error code - return ResultCode(-1); + return FileUtil::Rename(full_src_path, full_dest_path) ? RESULT_SUCCESS : ResultCode(-1); } ResultCode Disk_FileSystem::DeleteDirectory(const Path& path) const { diff --git a/src/core/file_sys/disk_filesystem.h b/src/core/file_sys/disk_filesystem.h index 8f9e1145a..591e39fda 100644 --- a/src/core/file_sys/disk_filesystem.h +++ b/src/core/file_sys/disk_filesystem.h @@ -26,7 +26,7 @@ public: ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const std::string& path, Mode mode) const override; ResultCode DeleteFile(const std::string& path) const override; - ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override; + ResultCode RenameFile(const std::string& src_path, const std::string& dest_path) const override; ResultCode DeleteDirectory(const Path& path) const override; ResultCode DeleteDirectoryRecursively(const Path& path) const override; ResultCode CreateFile(const std::string& path, u64 size) const override; diff --git a/src/core/file_sys/filesystem.h b/src/core/file_sys/filesystem.h index beefcfdb2..295a3133e 100644 --- a/src/core/file_sys/filesystem.h +++ b/src/core/file_sys/filesystem.h @@ -126,7 +126,8 @@ public: * @param dest_path Destination path relative to the archive * @return Result of the operation */ - virtual ResultCode RenameFile(const Path& src_path, const Path& dest_path) const = 0; + virtual ResultCode RenameFile(const std::string& src_path, + const std::string& dest_path) const = 0; /** * Rename 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 3d77e2d5f..b9982e6fa 100644 --- a/src/core/file_sys/romfs_filesystem.cpp +++ b/src/core/file_sys/romfs_filesystem.cpp @@ -27,7 +27,8 @@ ResultCode RomFS_FileSystem::DeleteFile(const std::string& path) const { return ResultCode(-1); } -ResultCode RomFS_FileSystem::RenameFile(const Path& src_path, const Path& dest_path) const { +ResultCode RomFS_FileSystem::RenameFile(const std::string& src_path, + const std::string& dest_path) const { LOG_CRITICAL(Service_FS, "Attempted to rename a file within an ROMFS archive (%s).", GetName().c_str()); // TODO(wwylele): Use correct error code diff --git a/src/core/file_sys/romfs_filesystem.h b/src/core/file_sys/romfs_filesystem.h index 1b5cac409..ba9d85823 100644 --- a/src/core/file_sys/romfs_filesystem.h +++ b/src/core/file_sys/romfs_filesystem.h @@ -32,7 +32,7 @@ public: ResultVal<std::unique_ptr<StorageBackend>> OpenFile(const std::string& path, Mode mode) const override; ResultCode DeleteFile(const std::string& path) const override; - ResultCode RenameFile(const Path& src_path, const Path& dest_path) const override; + ResultCode RenameFile(const std::string& src_path, const std::string& dest_path) const override; ResultCode DeleteDirectory(const Path& path) const override; ResultCode DeleteDirectoryRecursively(const Path& path) const override; ResultCode CreateFile(const std::string& path, u64 size) const override; |