diff --git a/FCHost/fchost/fchost_storage.cc b/FCHost/fchost/fchost_storage.cc index 666d9e6700f18bf25198e983b37c0b3bb1ed77b5..9ee70b298d69772378ab902ad891176b25a06af6 100644 --- a/FCHost/fchost/fchost_storage.cc +++ b/FCHost/fchost/fchost_storage.cc @@ -106,7 +106,15 @@ void FCHostPersistentStorage::load() readbuf[entrySize + 1] = readbuf[entrySize] = 0; // null terminate CefString val; val.FromString16(static_cast<const char16_t*>(static_cast<const void*>(readbuf.data()))); - storage.emplace(entry.path().filename().native(), CefV8Value::CreateString(val)); + auto sKey = entry.path().filename().native(); +#if defined(OS_WIN) + // put the fucking colon back in it + const size_t loc = sKey.find(L'#', 0); + if (loc != std::wstring::npos) { + sKey.replace(loc, static_cast<size_t>(1), L":"); + } +#endif + storage.emplace(sKey, CefV8Value::CreateString(val)); } } } @@ -115,7 +123,13 @@ void FCHostPersistentStorage::load() fs::path FCHostPersistentStorage::get_filename(const CefString& key) const { #if defined (OS_WIN) - return path / key.ToWString(); + std::wstring sKey = key.ToWString(); + // some fool decided to use a fucking colon as a key separator for SC V3 saves...can't have that in a filename on windows... + const size_t loc = sKey.find(L':', 0); + if (loc != std::wstring::npos) { + sKey.replace(loc, static_cast<size_t>(1), L"#"); + } + return path / sKey; #else return path / key.ToString(); #endif