Skip to content

Commit 66403b2

Browse files
Add more calls to TCHAR_TO_WCHAR
1 parent 12d56f0 commit 66403b2

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Source/UnrealEnginePython/Private/UnrealEnginePython.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ const char *ue4_module_options = "linux_global_symbols";
4747
#include "Android/AndroidApplication.h"
4848
#endif
4949

50-
5150
const char *UEPyUnicode_AsUTF8(PyObject *py_str)
5251
{
5352
#if PY_MAJOR_VERSION < 3
@@ -249,7 +248,11 @@ void FUnrealEnginePythonModule::StartupModule()
249248
if (GConfig->GetString(UTF8_TO_TCHAR("Python"), UTF8_TO_TCHAR("Home"), PythonHome, GEngineIni))
250249
{
251250
#if PY_MAJOR_VERSION >= 3
251+
#if ENGINE_MINOR_VERSION >= 20
252+
wchar_t *home = (wchar_t *)(TCHAR_TO_WCHAR(*PythonHome));
253+
#else
252254
wchar_t *home = (wchar_t *)*PythonHome;
255+
#endif
253256
#else
254257
char *home = TCHAR_TO_UTF8(*PythonHome);
255258
#endif
@@ -263,7 +266,11 @@ void FUnrealEnginePythonModule::StartupModule()
263266
FPaths::NormalizeFilename(PythonHome);
264267
PythonHome = FPaths::ConvertRelativePathToFull(PythonHome);
265268
#if PY_MAJOR_VERSION >= 3
269+
#if ENGINE_MINOR_VERSION >= 20
270+
wchar_t *home = (wchar_t *)(TCHAR_TO_WCHAR(*PythonHome));
271+
#else
266272
wchar_t *home = (wchar_t *)*PythonHome;
273+
#endif
267274
#else
268275
char *home = TCHAR_TO_UTF8(*PythonHome);
269276
#endif
@@ -277,7 +284,11 @@ void FUnrealEnginePythonModule::StartupModule()
277284
if (GConfig->GetString(UTF8_TO_TCHAR("Python"), UTF8_TO_TCHAR("ProgramName"), IniValue, GEngineIni))
278285
{
279286
#if PY_MAJOR_VERSION >= 3
287+
#if ENGINE_MINOR_VERSION >= 20
288+
wchar_t *program_name = (wchar_t *)(TCHAR_TO_WCHAR(*IniValue));
289+
#else
280290
wchar_t *program_name = (wchar_t *)*IniValue;
291+
#endif
281292
#else
282293
char *program_name = TCHAR_TO_UTF8(*IniValue);
283294
#endif
@@ -290,7 +301,11 @@ void FUnrealEnginePythonModule::StartupModule()
290301
FPaths::NormalizeFilename(IniValue);
291302
IniValue = FPaths::ConvertRelativePathToFull(IniValue);
292303
#if PY_MAJOR_VERSION >= 3
304+
#if ENGINE_MINOR_VERSION >= 20
305+
wchar_t *program_name = (wchar_t *)(TCHAR_TO_WCHAR(*IniValue));
306+
#else
293307
wchar_t *program_name = (wchar_t *)*IniValue;
308+
#endif
294309
#else
295310
char *program_name = TCHAR_TO_UTF8(*IniValue);
296311
#endif
@@ -391,6 +406,7 @@ void FUnrealEnginePythonModule::StartupModule()
391406
}
392407

393408
// Setup our own paths for PYTHONPATH
409+
#if PLATFORM_WINDOWS
394410
TArray<FString> OurPythonPaths = {
395411
PythonHome,
396412
FPaths::Combine(PythonHome, TEXT("Lib")),
@@ -403,10 +419,10 @@ void FUnrealEnginePythonModule::StartupModule()
403419
PathVars.Append(OurPythonPaths);
404420
FString ModifiedPath = FString::Join(PathVars, PathDelimiter);
405421
FPlatformMisc::SetEnvironmentVar(TEXT("PATH"), *ModifiedPath);
422+
#endif
406423
}
407424

408425

409-
410426
#if PY_MAJOR_VERSION >= 3
411427
init_unreal_engine_builtin();
412428
#if PLATFORM_ANDROID

0 commit comments

Comments
 (0)