mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 04:38:49 +00:00
Open std::fstream in a unicode-safe manner.
This commit is contained in:
parent
95558cdc69
commit
dea1e2827d
19 changed files with 57 additions and 25 deletions
|
@ -25,6 +25,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
// User directory indices for GetUserPath
|
||||
enum {
|
||||
|
@ -226,4 +227,15 @@ private:
|
|||
|
||||
} // namespace
|
||||
|
||||
// To deal with Windows being dumb at unicode:
|
||||
template <typename T>
|
||||
void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmode openmode)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
fstream.open(UTF8ToTStr(filename).c_str(), openmode);
|
||||
#else
|
||||
fstream.open(filename, openmode);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue