Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more calls to TCHAR_TO_WCHAR #644

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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