mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-06 04:04:53 +01:00
UTF8 paths are now properly handled on windows.
This commit is contained in:
parent
b8eae2b709
commit
51702b898e
5 changed files with 147 additions and 96 deletions
|
|
@ -84,6 +84,27 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
// Convert a wide Unicode string to an UTF8 string
|
||||
inline std::string utf8_encode(const std::wstring &wstr)
|
||||
{
|
||||
if( wstr.empty() ) return std::string();
|
||||
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
|
||||
std::string strTo( size_needed, 0 );
|
||||
WideCharToMultiByte (CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
|
||||
return strTo;
|
||||
}
|
||||
|
||||
// Convert an UTF8 string to a wide Unicode String
|
||||
inline std::wstring utf8_decode(const std::string &str)
|
||||
{
|
||||
if( str.empty() ) return std::wstring();
|
||||
int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);
|
||||
std::wstring wstrTo( size_needed, 0 );
|
||||
MultiByteToWideChar (CP_UTF8, 0, &str[0], (int)str.size(), &wstrTo[0], size_needed);
|
||||
return wstrTo;
|
||||
}
|
||||
|
||||
#elif defined(__LINUX__)
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
|
@ -112,6 +133,8 @@
|
|||
#define PRINT_DEBUG(...) {FILE *t = fopen("STEAM_LOG.txt", "a"); fprintf(t, __VA_ARGS__); fclose(t);}
|
||||
#endif
|
||||
#define PATH_SEPARATOR "/"
|
||||
|
||||
#define utf8_decode(a) a
|
||||
#endif
|
||||
//#define PRINT_DEBUG(...) fprintf(stdout, __VA_ARGS__)
|
||||
#ifdef EMU_RELEASE_BUILD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue