From d6087978b576b1c2baf6dacd573ccb778a4799f9 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Thu, 7 Nov 2019 23:46:01 +0300 Subject: [PATCH] Fix vfs::host::unlink (Win32) Use fs::get_virtual_device properly. --- rpcs3/Emu/VFS.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/VFS.cpp b/rpcs3/Emu/VFS.cpp index bcda050e60..803d6ae922 100644 --- a/rpcs3/Emu/VFS.cpp +++ b/rpcs3/Emu/VFS.cpp @@ -582,7 +582,11 @@ bool vfs::host::rename(const std::string& from, const std::string& to, bool over bool vfs::host::unlink(const std::string& path, const std::string& dev_root) { #ifdef _WIN32 - if (path.size() < 2 || reinterpret_cast(path.front()) != "//"_u16) + if (auto device = fs::get_virtual_device(path)) + { + return device->remove(path); + } + else { // Rename to special dummy name which will be ignored by VFS (but opened file handles can still read or write it) const std::string dummy = fmt::format(u8"%s/$%s%s", dev_root, fmt::base57(std::hash()(path)), fmt::base57(__rdtsc())); @@ -602,9 +606,9 @@ bool vfs::host::unlink(const std::string& path, const std::string& dev_root) // TODO: what could cause this and how to handle it return true; } -#endif - +#else return fs::remove_file(path); +#endif } bool vfs::host::remove_all(const std::string& path, const std::string& dev_root, bool remove_root)