Skip to content

Commit 5efc1aa

Browse files
author
Roberto De Ioris
committed
added ProgramName and RelativeProgramName config directives
1 parent c78dbf4 commit 5efc1aa

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Source/UnrealEnginePython/Private/UnrealEnginePython.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,25 @@ void FUnrealEnginePythonModule::StartupModule()
130130
Py_SetPythonHome(home);
131131
}
132132

133+
if (GConfig->GetString(UTF8_TO_TCHAR("Python"), UTF8_TO_TCHAR("ProgramName"), IniValue, GEngineIni)) {
134+
#if PY_MAJOR_VERSION >= 3
135+
wchar_t *program_name = (wchar_t *)*IniValue;
136+
#else
137+
char *program_name = TCHAR_TO_UTF8(*IniValue);
138+
#endif
139+
Py_SetProgramName(program_name);
140+
}
141+
142+
if (GConfig->GetString(UTF8_TO_TCHAR("Python"), UTF8_TO_TCHAR("RelativeProgramName"), IniValue, GEngineIni)) {
143+
IniValue = FPaths::Combine(FPaths::GameContentDir(), IniValue);
144+
#if PY_MAJOR_VERSION >= 3
145+
wchar_t *program_name = (wchar_t *)*IniValue;
146+
#else
147+
char *program_name = TCHAR_TO_UTF8(*IniValue);
148+
#endif
149+
Py_SetProgramName(program_name);
150+
}
151+
133152
if (GConfig->GetString(UTF8_TO_TCHAR("Python"), UTF8_TO_TCHAR("ScriptsPath"), IniValue, GEngineIni)) {
134153
ScriptsPath = IniValue;
135154
}

0 commit comments

Comments
 (0)