Fixed some dumb mistakes.

This commit is contained in:
goeiecool9999 2022-09-07 20:45:55 +02:00 committed by klaas
parent d5f6cd5bd6
commit b1b6a5d8c3
5 changed files with 13 additions and 24 deletions

View file

@ -1,11 +1,15 @@
#include "FSPath.h" #include "FSPath.h"
#ifndef BOOST_OS_UNIX FSPath& FSPath::operator/ (const FSPath & other)
FSPath& FSPath::operator/= (const FSPath & other)
{ {
*this /= other; *this /= other;
return *this; return *this;
} }
#ifndef BOOST_OS_UNIX
FSPath& FSPath::operator/= (const FSPath & other)
{
fs::path::operator/=(other);
}
#else #else
FSPath& FSPath::operator/= (const FSPath & other) FSPath& FSPath::operator/= (const FSPath & other)
{ {

View file

@ -9,10 +9,10 @@ class FSPath : public fs::path {
FSPath(const T & other) : fs::path(other) {}; FSPath(const T & other) : fs::path(other) {};
template <class T> template <class T>
static FSPath Convert(const T& input) { static FSPath Convert(const T& input)
FSPath p; {
p /= input; return FSPath{} / input;
return p;
} }
FSPath& operator/= (const FSPath & other); FSPath& operator/= (const FSPath & other);
FSPath& operator/ (const FSPath & other);
}; };

View file

@ -222,25 +222,10 @@ FSCVirtualFile* FSCVirtualFile_Host::OpenFile(const FSPath& path, FSC_ACCESS_FLA
class fscDeviceHostFSC : public fscDeviceC { class fscDeviceHostFSC : public fscDeviceC {
public: 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 FSCVirtualFile* fscDeviceOpenByPath(std::wstring_view path, FSC_ACCESS_FLAG accessFlags, void* ctx, sint32* fscStatus) override
{ {
*fscStatus = FSC_STATUS_OK; *fscStatus = FSC_STATUS_OK;
FSCVirtualFile* vf = FSCVirtualFile_Host::OpenFile(path, accessFlags, *fscStatus); FSCVirtualFile* vf = FSCVirtualFile_Host::OpenFile(FSPath::Convert(path), accessFlags, *fscStatus);
#ifdef BOOST_OS_UNIX
// failed to open file. maybe the case is different?
if (!vf)
{
vf = fscDeviceOpenByPathIgnoreCase(path, accessFlags, fscStatus);
}
#endif
cemu_assert_debug((bool)vf == (*fscStatus == FSC_STATUS_OK)); cemu_assert_debug((bool)vf == (*fscStatus == FSC_STATUS_OK));
return vf; return vf;
} }

View file

@ -223,7 +223,7 @@ FSPath ActiveSettings::GetMlcPath()
FSPath ActiveSettings::GetMlcPath(std::string_view p) FSPath ActiveSettings::GetMlcPath(std::string_view p)
{ {
std::basic_string_view<char8_t> s((const char8_t*)p.data(), p.size()); std::basic_string_view<char8_t> s((const char8_t*)p.data(), p.size());
return GetMlcPath() / fs::path(s); return GetMlcPath() / FSPath(s);
} }
fs::path ActiveSettings::GetDefaultMLCPath() fs::path ActiveSettings::GetDefaultMLCPath()

View file

@ -43,7 +43,7 @@ public:
{ {
cemu_assert_debug(format.empty() || (format[0] != '/' && format[0] != '\\')); cemu_assert_debug(format.empty() || (format[0] != '/' && format[0] != '\\'));
auto tmp = fmt::format(fmt::runtime(format), std::forward<TArgs>(args)...); auto tmp = fmt::format(fmt::runtime(format), std::forward<TArgs>(args)...);
return GetMlcPath() / fs::path(_asUtf8(tmp)); return GetMlcPath() / FSPath(_asUtf8(tmp));
} }
template <typename ...TArgs> template <typename ...TArgs>