@@ -159,25 +159,25 @@ void FUnrealEnginePythonModule::StartupModule()
159159 BrutalFinalize = false ;
160160
161161 // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
162- FString IniValue ;
163- if (GConfig->GetString (UTF8_TO_TCHAR (" Python" ), UTF8_TO_TCHAR (" Home" ), IniValue , GEngineIni)) {
162+ FString PythonHome ;
163+ if (GConfig->GetString (UTF8_TO_TCHAR (" Python" ), UTF8_TO_TCHAR (" Home" ), PythonHome , GEngineIni)) {
164164#if PY_MAJOR_VERSION >= 3
165- wchar_t *home = (wchar_t *)*IniValue ;
165+ wchar_t *home = (wchar_t *)*PythonHome ;
166166#else
167- char *home = TCHAR_TO_UTF8 (*IniValue );
167+ char *home = TCHAR_TO_UTF8 (*PythonHome );
168168#endif
169- FPlatformMisc::SetEnvironmentVar (TEXT (" PYTHONHOME" ), *IniValue );
169+ FPlatformMisc::SetEnvironmentVar (TEXT (" PYTHONHOME" ), *PythonHome );
170170 Py_SetPythonHome (home);
171171 }
172172
173- if (GConfig->GetString (UTF8_TO_TCHAR (" Python" ), UTF8_TO_TCHAR (" RelativeHome" ), IniValue , GEngineIni)) {
174- IniValue = FPaths::Combine (*PROJECT_CONTENT_DIR , *IniValue );
175- FPaths::NormalizeFilename (IniValue );
176- IniValue = FPaths::ConvertRelativePathToFull (IniValue );
173+ if (GConfig->GetString (UTF8_TO_TCHAR (" Python" ), UTF8_TO_TCHAR (" RelativeHome" ), PythonHome , GEngineIni)) {
174+ PythonHome = FPaths::Combine (*PROJECT_CONTENT_DIR , *PythonHome );
175+ FPaths::NormalizeFilename (PythonHome );
176+ PythonHome = FPaths::ConvertRelativePathToFull (PythonHome );
177177#if PY_MAJOR_VERSION >= 3
178- wchar_t *home = (wchar_t *)*IniValue ;
178+ wchar_t *home = (wchar_t *)*PythonHome ;
179179#else
180- char *home = TCHAR_TO_UTF8 (*IniValue );
180+ char *home = TCHAR_TO_UTF8 (*PythonHome );
181181#endif
182182
183183 Py_SetPythonHome (home);
@@ -245,9 +245,9 @@ void FUnrealEnginePythonModule::StartupModule()
245245 // To ensure there are no path conflicts, if we have a valid python home at this point,
246246 // we override the current environment entirely with the environment we want to use,
247247 // removing any paths to other python environments we aren't using.
248- if (IniValue .Len () > 0 )
248+ if (PythonHome .Len () > 0 )
249249 {
250- FPlatformMisc::SetEnvironmentVar (TEXT (" PYTHONHOME" ), *IniValue );
250+ FPlatformMisc::SetEnvironmentVar (TEXT (" PYTHONHOME" ), *PythonHome );
251251
252252 const int32 MaxPathVarLen = 32768 ;
253253 FString OrigPathVar = FString::ChrN (MaxPathVarLen, TEXT (' \0 ' ));
@@ -268,9 +268,9 @@ void FUnrealEnginePythonModule::StartupModule()
268268
269269 // Setup our own paths for PYTHONPATH
270270 TArray<FString> OurPythonPaths = {
271- IniValue ,
272- FPaths::Combine (IniValue , TEXT (" Lib" )),
273- FPaths::Combine (IniValue , TEXT (" Lib/site-packages" )),
271+ PythonHome ,
272+ FPaths::Combine (PythonHome , TEXT (" Lib" )),
273+ FPaths::Combine (PythonHome , TEXT (" Lib/site-packages" )),
274274 };
275275 FString PythonPathVars = FString::Join (OurPythonPaths, PathDelimiter);
276276 FPlatformMisc::SetEnvironmentVar (TEXT (" PYTHONPATH" ), *PythonPathVars);
0 commit comments