Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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 20 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.