Skip to content

Commit 5682961

Browse files
committed
Further fixes to Linux target. It should now work well.
1 parent 09d3266 commit 5682961

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Source/PythonEngine.pas

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4216,7 +4216,7 @@ procedure TPythonEngine.Initialize;
42164216

42174217
gPythonEngine := Self;
42184218
CheckRegistry;
4219-
if Assigned(Py_SetProgramName) and (ProgramName <> '') then
4219+
if Assigned(Py_SetProgramName) and (Length(FProgramName) > 0) then
42204220
Py_SetProgramName(PWCharT(FProgramName));
42214221
AssignPyFlags;
42224222
if Length(FPythonHome) > 0 then
@@ -4468,7 +4468,10 @@ procedure TPythonEngine.SetPyFlags(const Value: TPythonFlags);
44684468
function TPythonEngine.GetPythonHome: UnicodeString;
44694469
begin
44704470
{$IFDEF POSIX}
4471-
Result := UCS4StringToUnicodeString(FPythonHome);
4471+
if Length(FPythonHome) = 0 then
4472+
Result := ''
4473+
else
4474+
Result := UCS4StringToUnicodeString(FPythonHome);
44724475
{$ELSE}
44734476
Result := FPythonHome;
44744477
{$ENDIF}
@@ -4477,7 +4480,10 @@ function TPythonEngine.GetPythonHome: UnicodeString;
44774480
function TPythonEngine.GetProgramName: UnicodeString;
44784481
begin
44794482
{$IFDEF POSIX}
4480-
Result := UCS4StringToUnicodeString(FProgramName);
4483+
if Length(FProgramName) = 0 then
4484+
Result := ''
4485+
else
4486+
Result := UCS4StringToUnicodeString(FProgramName);
44814487
{$ELSE}
44824488
Result := FProgramName;
44834489
{$ENDIF}

0 commit comments

Comments
 (0)