diff --git a/Source/UnrealEnginePython/Private/UnrealEnginePython.cpp b/Source/UnrealEnginePython/Private/UnrealEnginePython.cpp index 211124849..41113d733 100644 --- a/Source/UnrealEnginePython/Private/UnrealEnginePython.cpp +++ b/Source/UnrealEnginePython/Private/UnrealEnginePython.cpp @@ -47,7 +47,6 @@ const char *ue4_module_options = "linux_global_symbols"; #include "Android/AndroidApplication.h" #endif - const char *UEPyUnicode_AsUTF8(PyObject *py_str) { #if PY_MAJOR_VERSION < 3 @@ -249,7 +248,11 @@ void FUnrealEnginePythonModule::StartupModule() if (GConfig->GetString(UTF8_TO_TCHAR("Python"), UTF8_TO_TCHAR("Home"), PythonHome, GEngineIni)) { #if PY_MAJOR_VERSION >= 3 + #if ENGINE_MINOR_VERSION >= 20 + wchar_t *home = (wchar_t *)(TCHAR_TO_WCHAR(*PythonHome)); + #else wchar_t *home = (wchar_t *)*PythonHome; + #endif #else char *home = TCHAR_TO_UTF8(*PythonHome); #endif @@ -263,7 +266,11 @@ void FUnrealEnginePythonModule::StartupModule() FPaths::NormalizeFilename(PythonHome); PythonHome = FPaths::ConvertRelativePathToFull(PythonHome); #if PY_MAJOR_VERSION >= 3 + #if ENGINE_MINOR_VERSION >= 20 + wchar_t *home = (wchar_t *)(TCHAR_TO_WCHAR(*PythonHome)); + #else wchar_t *home = (wchar_t *)*PythonHome; + #endif #else char *home = TCHAR_TO_UTF8(*PythonHome); #endif @@ -277,7 +284,11 @@ void FUnrealEnginePythonModule::StartupModule() if (GConfig->GetString(UTF8_TO_TCHAR("Python"), UTF8_TO_TCHAR("ProgramName"), IniValue, GEngineIni)) { #if PY_MAJOR_VERSION >= 3 + #if ENGINE_MINOR_VERSION >= 20 + wchar_t *program_name = (wchar_t *)(TCHAR_TO_WCHAR(*IniValue)); + #else wchar_t *program_name = (wchar_t *)*IniValue; + #endif #else char *program_name = TCHAR_TO_UTF8(*IniValue); #endif @@ -290,7 +301,11 @@ void FUnrealEnginePythonModule::StartupModule() FPaths::NormalizeFilename(IniValue); IniValue = FPaths::ConvertRelativePathToFull(IniValue); #if PY_MAJOR_VERSION >= 3 + #if ENGINE_MINOR_VERSION >= 20 + wchar_t *program_name = (wchar_t *)(TCHAR_TO_WCHAR(*IniValue)); + #else wchar_t *program_name = (wchar_t *)*IniValue; + #endif #else char *program_name = TCHAR_TO_UTF8(*IniValue); #endif @@ -391,6 +406,7 @@ void FUnrealEnginePythonModule::StartupModule() } // Setup our own paths for PYTHONPATH + #if PLATFORM_WINDOWS TArray OurPythonPaths = { PythonHome, FPaths::Combine(PythonHome, TEXT("Lib")), @@ -403,10 +419,10 @@ void FUnrealEnginePythonModule::StartupModule() PathVars.Append(OurPythonPaths); FString ModifiedPath = FString::Join(PathVars, PathDelimiter); FPlatformMisc::SetEnvironmentVar(TEXT("PATH"), *ModifiedPath); + #endif } - #if PY_MAJOR_VERSION >= 3 init_unreal_engine_builtin(); #if PLATFORM_ANDROID