Android compile fix

This commit is contained in:
Joshua Granick
2018-07-19 21:53:06 -07:00
parent cc52e26391
commit 984cb14650
2 changed files with 24 additions and 5 deletions

View File

@@ -48,8 +48,10 @@
#include <utils/compress/Zlib.h>
#include <vm/NekoVM.h>
#ifdef HX_WINDOWS
#include <locale>
#include <codecvt>
#endif
DEFINE_KIND (k_finalizer);
@@ -134,8 +136,12 @@ namespace lime {
if (val.c_str ()) {
std::string _val = std::string (val.c_str ());
#ifdef HX_WINDOWS
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return new std::wstring (converter.from_bytes (_val));
#else
return new std::wstring (_val.begin (), _val.end ());
#endif
} else {
@@ -151,8 +157,12 @@ namespace lime {
if (val) {
std::string _val = std::string (hl_to_utf8 (val->bytes));
#ifdef HX_WINDOWS
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
return new std::wstring (converter.from_bytes (_val));
#else
return new std::wstring (_val.begin (), _val.end ());
#endif
} else {

View File

@@ -32,9 +32,12 @@
#endif
#include <SDL.h>
#include <string>
#ifdef HX_WINDOWS
#include <locale>
#include <codecvt>
#include <string>
#endif
namespace lime {
@@ -101,8 +104,12 @@ namespace lime {
case APPLICATION: {
char* path = SDL_GetBasePath ();
#ifdef HX_WINDOWS
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes(path));
#else
result = new std::wstring (path, path + strlen (path));
#endif
SDL_free (path);
break;
@@ -111,8 +118,12 @@ namespace lime {
case APPLICATION_STORAGE: {
char* path = SDL_GetPrefPath (company, title);
#ifdef HX_WINDOWS
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes(path));
#else
result = new std::wstring (path, path + strlen (path));
#endif
SDL_free (path);
break;
@@ -185,8 +196,7 @@ namespace lime {
if (home != NULL) {
std::string path = std::string (home) + std::string ("/Documents");
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes (path.c_str ()));
result = new std::wstring (path.begin (), path.end ());
}
@@ -264,8 +274,7 @@ namespace lime {
if (home != NULL) {
std::string path = std::string (home);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
result = new std::wstring (converter.from_bytes (path.c_str ()));
result = new std::wstring (path.begin (), path.end ());
}