From 333084250591d0cd2e88ebdb722a36003c2ae213 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sun, 17 Feb 2013 01:33:22 -0600 Subject: Let's not CreateDir an empty string every time CreateFullPath is used, logging an error every time. --- Source/Core/Common/Src/FileUtil.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Core/Common/Src/FileUtil.cpp') diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index d74c99b7a2..8e1bec2809 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -196,8 +196,9 @@ bool CreateFullPath(const std::string &fullPath) // we're done, yay! if (position == fullPath.npos) return true; - - std::string subPath = fullPath.substr(0, position); + + // Include the '/' so the first call is CreateDir("/") rather than CreateDir("") + std::string const subPath(fullPath.substr(0, position + 1)); if (!File::IsDirectory(subPath)) File::CreateDir(subPath); -- cgit v1.2.3 From fa9aafeed8753b0fd8f039d3d740b97c1bfad4dd Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sun, 17 Feb 2013 13:30:04 -0600 Subject: Some cleanup of CWII_IPC_HLE_Device_FileIO: The real file was never kept open for longer than a single operation so there was no point in dealing with it in DoState. Saving the real path in the savestate was also probably a bad idea. Savestates should be a bit more portable now. --- Source/Core/Common/Src/FileUtil.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Source/Core/Common/Src/FileUtil.cpp') diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index 8e1bec2809..d6ab33962a 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -42,6 +42,7 @@ #endif #include +#include #include #ifndef S_ISDIR @@ -774,6 +775,24 @@ IOFile::~IOFile() Close(); } +IOFile::IOFile(IOFile&& other) + : m_file(NULL), m_good(true) +{ + Swap(other); +} + +IOFile& IOFile::operator=(IOFile other) +{ + Swap(other); + return *this; +} + +void IOFile::Swap(IOFile& other) +{ + std::swap(m_file, other.m_file); + std::swap(m_good, other.m_good); +} + bool IOFile::Open(const std::string& filename, const char openmode[]) { Close(); -- cgit v1.2.3