From b1b6a5d8c3520224389f342c9bc0dec245dc591f Mon Sep 17 00:00:00 2001 From: goeiecool9999 <> Date: Wed, 7 Sep 2022 20:45:55 +0200 Subject: [PATCH] Fixed some dumb mistakes. --- src/Cafe/Filesystem/FSPath.cpp | 8 ++++++-- src/Cafe/Filesystem/FSPath.h | 8 ++++---- src/Cafe/Filesystem/fscDeviceHostFS.cpp | 17 +---------------- src/config/ActiveSettings.cpp | 2 +- src/config/ActiveSettings.h | 2 +- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/Cafe/Filesystem/FSPath.cpp b/src/Cafe/Filesystem/FSPath.cpp index c762f866..0720f55a 100644 --- a/src/Cafe/Filesystem/FSPath.cpp +++ b/src/Cafe/Filesystem/FSPath.cpp @@ -1,11 +1,15 @@ #include "FSPath.h" -#ifndef BOOST_OS_UNIX -FSPath& FSPath::operator/= (const FSPath & other) +FSPath& FSPath::operator/ (const FSPath & other) { *this /= other; return *this; } +#ifndef BOOST_OS_UNIX +FSPath& FSPath::operator/= (const FSPath & other) +{ + fs::path::operator/=(other); +} #else FSPath& FSPath::operator/= (const FSPath & other) { diff --git a/src/Cafe/Filesystem/FSPath.h b/src/Cafe/Filesystem/FSPath.h index 6bd8a72a..30194760 100644 --- a/src/Cafe/Filesystem/FSPath.h +++ b/src/Cafe/Filesystem/FSPath.h @@ -9,10 +9,10 @@ class FSPath : public fs::path { FSPath(const T & other) : fs::path(other) {}; template - static FSPath Convert(const T& input) { - FSPath p; - p /= input; - return p; + static FSPath Convert(const T& input) + { + return FSPath{} / input; } FSPath& operator/= (const FSPath & other); + FSPath& operator/ (const FSPath & other); }; \ No newline at end of file diff --git a/src/Cafe/Filesystem/fscDeviceHostFS.cpp b/src/Cafe/Filesystem/fscDeviceHostFS.cpp index 68899e84..8216c6e1 100644 --- a/src/Cafe/Filesystem/fscDeviceHostFS.cpp +++ b/src/Cafe/Filesystem/fscDeviceHostFS.cpp @@ -222,25 +222,10 @@ FSCVirtualFile* FSCVirtualFile_Host::OpenFile(const FSPath& path, FSC_ACCESS_FLA class fscDeviceHostFSC : public fscDeviceC { public: - FSCVirtualFile* fscDeviceOpenByPathIgnoreCase(std::wstring_view pathString, FSC_ACCESS_FLAG accessFlags, sint32* fscStatus) - { - *fscStatus = FSC_STATUS_OK; - - FSPath correctedPath = FSPath::Convert(pathString); - return FSCVirtualFile_Host::OpenFile(correctedPath, accessFlags, *fscStatus); - } - FSCVirtualFile* fscDeviceOpenByPath(std::wstring_view path, FSC_ACCESS_FLAG accessFlags, void* ctx, sint32* fscStatus) override { *fscStatus = FSC_STATUS_OK; - FSCVirtualFile* vf = FSCVirtualFile_Host::OpenFile(path, accessFlags, *fscStatus); -#ifdef BOOST_OS_UNIX - // failed to open file. maybe the case is different? - if (!vf) - { - vf = fscDeviceOpenByPathIgnoreCase(path, accessFlags, fscStatus); - } -#endif + FSCVirtualFile* vf = FSCVirtualFile_Host::OpenFile(FSPath::Convert(path), accessFlags, *fscStatus); cemu_assert_debug((bool)vf == (*fscStatus == FSC_STATUS_OK)); return vf; } diff --git a/src/config/ActiveSettings.cpp b/src/config/ActiveSettings.cpp index 023cdd65..a3f34d58 100644 --- a/src/config/ActiveSettings.cpp +++ b/src/config/ActiveSettings.cpp @@ -223,7 +223,7 @@ FSPath ActiveSettings::GetMlcPath() FSPath ActiveSettings::GetMlcPath(std::string_view p) { std::basic_string_view s((const char8_t*)p.data(), p.size()); - return GetMlcPath() / fs::path(s); + return GetMlcPath() / FSPath(s); } fs::path ActiveSettings::GetDefaultMLCPath() diff --git a/src/config/ActiveSettings.h b/src/config/ActiveSettings.h index 9a05752b..afa2c5e9 100644 --- a/src/config/ActiveSettings.h +++ b/src/config/ActiveSettings.h @@ -43,7 +43,7 @@ public: { cemu_assert_debug(format.empty() || (format[0] != '/' && format[0] != '\\')); auto tmp = fmt::format(fmt::runtime(format), std::forward(args)...); - return GetMlcPath() / fs::path(_asUtf8(tmp)); + return GetMlcPath() / FSPath(_asUtf8(tmp)); } template