Skip to content

Commit

Permalink
Add more calls to TCHAR_TO_WCHAR
Browse files Browse the repository at this point in the history
  • Loading branch information
slartibaartfast committed Jul 17, 2019
1 parent 12d56f0 commit 66403b2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Source/UnrealEnginePython/Private/UnrealEnginePython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -391,6 +406,7 @@ void FUnrealEnginePythonModule::StartupModule()
}

// Setup our own paths for PYTHONPATH
#if PLATFORM_WINDOWS
TArray<FString> OurPythonPaths = {
PythonHome,
FPaths::Combine(PythonHome, TEXT("Lib")),
Expand All @@ -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
Expand Down

0 comments on commit 66403b2

Please sign in to comment.