summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2023-08-24 17:07:39 +0200
committerFearlessTobi <thm.frey@gmail.com>2023-08-24 17:07:39 +0200
commita669e37ddb0634366d92e8a56ed5c302e8e52bcb (patch)
treec67203e52106b1a744295dddbafd8ce6efe14ac8 /src/core/hle/service
parentgame_list_worker: Display correct size for NAX games (diff)
downloadyuzu-a669e37ddb0634366d92e8a56ed5c302e8e52bcb.tar
yuzu-a669e37ddb0634366d92e8a56ed5c302e8e52bcb.tar.gz
yuzu-a669e37ddb0634366d92e8a56ed5c302e8e52bcb.tar.bz2
yuzu-a669e37ddb0634366d92e8a56ed5c302e8e52bcb.tar.lz
yuzu-a669e37ddb0634366d92e8a56ed5c302e8e52bcb.tar.xz
yuzu-a669e37ddb0634366d92e8a56ed5c302e8e52bcb.tar.zst
yuzu-a669e37ddb0634366d92e8a56ed5c302e8e52bcb.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 4c1ea1a5b..508db7360 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -4,6 +4,7 @@
#include <utility>
#include "common/assert.h"
+#include "common/fs/fs.h"
#include "common/fs/path_util.h"
#include "common/settings.h"
#include "core/core.h"
@@ -154,10 +155,18 @@ Result VfsDirectoryServiceWrapper::RenameFile(const std::string& src_path_,
std::string src_path(Common::FS::SanitizePath(src_path_));
std::string dest_path(Common::FS::SanitizePath(dest_path_));
auto src = backing->GetFileRelative(src_path);
+ auto dst = backing->GetFileRelative(dest_path);
if (Common::FS::GetParentPath(src_path) == Common::FS::GetParentPath(dest_path)) {
// Use more-optimized vfs implementation rename.
- if (src == nullptr)
+ if (src == nullptr) {
return FileSys::ERROR_PATH_NOT_FOUND;
+ }
+
+ if (dst && Common::FS::Exists(dst->GetFullPath())) {
+ LOG_ERROR(Service_FS, "File at new_path={} already exists", dst->GetFullPath());
+ return FileSys::ERROR_PATH_ALREADY_EXISTS;
+ }
+
if (!src->Rename(Common::FS::GetFilename(dest_path))) {
// TODO(DarkLordZach): Find a better error code for this
return ResultUnknown;