diff --git a/Utilities/File.cpp b/Utilities/File.cpp index f846205007..7bc1963604 100644 --- a/Utilities/File.cpp +++ b/Utilities/File.cpp @@ -1328,15 +1328,6 @@ fs::native_handle fs::file::get_handle() const #endif } -#ifdef _WIN32 -bool fs::file::set_delete(bool autodelete) const -{ - FILE_DISPOSITION_INFO disp; - disp.DeleteFileW = autodelete; - return SetFileInformationByHandle(get_handle(), FileDispositionInfo, &disp, sizeof(disp)) != 0; -} -#endif - void fs::dir::xnull() const { fmt::throw_exception("fs::dir is null"); diff --git a/Utilities/File.h b/Utilities/File.h index 5f805d438b..6e426d365c 100644 --- a/Utilities/File.h +++ b/Utilities/File.h @@ -377,11 +377,6 @@ namespace fs if (!m_file) xnull(); return m_file->write_gather(buffers, buf_count); } - -#ifdef _WIN32 - // Windows-specific function - bool set_delete(bool autodelete = true) const; -#endif }; class dir final diff --git a/Utilities/Log.cpp b/Utilities/Log.cpp index 7730575b6f..fbb0fc1fca 100644 --- a/Utilities/Log.cpp +++ b/Utilities/Log.cpp @@ -415,7 +415,9 @@ logs::file_writer::file_writer(const std::string& name) #ifdef _WIN32 // Autodelete compressed log file - m_fout2.set_delete(); + FILE_DISPOSITION_INFO disp; + disp.DeleteFileW = true; + SetFileInformationByHandle(m_fout2.get_handle(), FileDispositionInfo, &disp, sizeof(disp)); #endif } catch (const std::exception& e) @@ -495,7 +497,9 @@ logs::file_writer::~file_writer() #ifdef _WIN32 // Cancel compressed log file autodeletion - m_fout2.set_delete(false); + FILE_DISPOSITION_INFO disp; + disp.DeleteFileW = false; + SetFileInformationByHandle(m_fout2.get_handle(), FileDispositionInfo, &disp, sizeof(disp)); UnmapViewOfFile(m_fptr); CloseHandle(m_fmap); diff --git a/rpcs3/Emu/VFS.cpp b/rpcs3/Emu/VFS.cpp index 803d6ae922..95da084ee3 100644 --- a/rpcs3/Emu/VFS.cpp +++ b/rpcs3/Emu/VFS.cpp @@ -6,6 +6,10 @@ #include "Utilities/mutex.h" #include "Utilities/StrUtil.h" +#ifdef _WIN32 +#include +#endif + struct vfs_directory { // Real path (empty if root or not exists) @@ -599,7 +603,9 @@ bool vfs::host::unlink(const std::string& path, const std::string& dev_root) if (fs::file f{dummy, fs::read + fs::write}) { // Set to delete on close on last handle - f.set_delete(); + FILE_DISPOSITION_INFO disp; + disp.DeleteFileW = true; + SetFileInformationByHandle(f.get_handle(), FileDispositionInfo, &disp, sizeof(disp)); return true; }