Skip to content

Commit fc9f0c8

Browse files
committed
Merge branch 'CustomPath'
# Conflicts: # Source/UnrealEnginePython/Private/UnrealEnginePython.cpp
2 parents 98769b7 + f2de7ff commit fc9f0c8

File tree

3 files changed

+16
-33
lines changed

3 files changed

+16
-33
lines changed

Source/UnrealEnginePython/Private/UnrealEnginePython.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ void FUnrealEnginePythonModule::StartupModule()
387387
IniValue.ParseIntoArray(ImportModules, separators, 3);
388388
}
389389

390-
FString ProjectScriptsPath = FPaths::Combine(*PROJECT_CONTENT_DIR, UTF8_TO_TCHAR("Scripts"));
390+
FString ProjectScriptsPath = FPaths::Combine(*PROJECT_CONTENT_DIR, UTF8_TO_TCHAR("PythonScripts"));
391391
if (!FPaths::DirectoryExists(ProjectScriptsPath))
392392
{
393393
FPlatformFileManager::Get().GetPlatformFile().CreateDirectory(*ProjectScriptsPath);
@@ -397,7 +397,7 @@ void FUnrealEnginePythonModule::StartupModule()
397397
#if WITH_EDITOR
398398
for (TSharedRef<IPlugin>plugin : IPluginManager::Get().GetEnabledPlugins())
399399
{
400-
FString PluginScriptsPath = FPaths::Combine(plugin->GetContentDir(), UTF8_TO_TCHAR("Scripts"));
400+
FString PluginScriptsPath = FPaths::Combine(plugin->GetContentDir(), UTF8_TO_TCHAR("PythonScripts"));
401401
if (FPaths::DirectoryExists(PluginScriptsPath))
402402
{
403403
ScriptsPaths.Add(PluginScriptsPath);
@@ -465,7 +465,7 @@ void FUnrealEnginePythonModule::StartupModule()
465465
#if PY_MAJOR_VERSION >= 3
466466
init_unreal_engine_builtin();
467467
#if PLATFORM_ANDROID
468-
FString InDirectory = FString(TEXT("Scripts"));
468+
FString InDirectory = FString(TEXT("PythonScripts"));
469469

470470
extern FString GExternalFilePath;
471471

@@ -479,7 +479,7 @@ void FUnrealEnginePythonModule::StartupModule()
479479

480480
FileManager->IterateDirectoryRecursively(*DirectoryPath, Visitor);
481481

482-
FString Prefix = FApp::GetProjectName() / FString(TEXT("Content/Scripts/"));
482+
FString Prefix = FApp::GetProjectName() / FString(TEXT("Content/PythonScripts/"));
483483

484484
for (TMap<FString, FDateTime>::TIterator TimestampIt(Visitor.FileTimes); TimestampIt; ++TimestampIt)
485485
{
@@ -513,7 +513,7 @@ void FUnrealEnginePythonModule::StartupModule()
513513
FString IOSContentPath = IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*IFileManager::Get().GetFilenameOnDisk(*FPaths::ConvertRelativePathToFull(PROJECT_CONTENT_DIR)));
514514
FString PyScriptsSearchPath = IOSContentPath / FString(TEXT("lib")) + FString(":") +
515515
IOSContentPath / FString(TEXT("lib/stdlib.zip")) + FString(":") +
516-
IOSContentPath / FString(TEXT("scripts")); // the name of directory must be lower-case.
516+
IOSContentPath / FString(TEXT("pythonscripts")); // the name of directory must be lower-case.
517517

518518
Py_SetPath(Py_DecodeLocale(TCHAR_TO_UTF8(*PyScriptsSearchPath), NULL));
519519

Source/UnrealEnginePython/Public/UnrealEnginePython.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#include "Runtime/Launch/Resources/Version.h"
2828

2929
#if PLATFORM_MAC
30-
#include <Headers/Python.h>
31-
#include <Headers/structmember.h>
30+
#include <Python.h>
31+
#include <structmember.h>
3232
#elif PLATFORM_LINUX
3333
#include <Python.h>
3434
#include <structmember.h>

Source/UnrealEnginePython/UnrealEnginePython.Build.cs

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -219,35 +219,18 @@ public UnrealEnginePython(TargetInfo Target)
219219

220220
if (Target.Platform == UnrealTargetPlatform.Win64)
221221
{
222-
if (pythonHome == "")
223-
{
224-
pythonHome = DiscoverPythonPath(windowsKnownPaths, "Win64");
225-
if (pythonHome == "")
226-
{
227-
throw new System.Exception("Unable to find Python installation");
228-
}
229-
}
230-
System.Console.WriteLine("Using Python at: " + pythonHome);
231-
PublicIncludePaths.Add(pythonHome);
232-
string libPath = GetWindowsPythonLibFile(pythonHome);
233-
PublicSystemLibraryPaths.Add(Path.GetDirectoryName(libPath));
234-
PublicAdditionalLibraries.Add(libPath);
222+
string PythonHome = Path.Combine(Target.UEThirdPartyBinariesDirectory, "Python3/Win64");
223+
PublicIncludePaths.Add(PythonHome);
224+
string LibPath = Path.Combine(Target.UEThirdPartySourceDirectory, "Python3/Win64/libs/python39.lib");
225+
PublicSystemLibraryPaths.Add(Path.GetDirectoryName(LibPath));
226+
PublicAdditionalLibraries.Add(LibPath);
235227
}
236228
else if (Target.Platform == UnrealTargetPlatform.Mac)
237229
{
238-
if (pythonHome == "")
239-
{
240-
pythonHome = DiscoverPythonPath(macKnownPaths, "Mac");
241-
if (pythonHome == "")
242-
{
243-
throw new System.Exception("Unable to find Python installation");
244-
}
245-
}
246-
System.Console.WriteLine("Using Python at: " + pythonHome);
247-
PublicIncludePaths.Add(pythonHome);
248-
string libPath = GetMacPythonLibFile(pythonHome);
249-
PublicAdditionalLibraries.Add(Path.GetDirectoryName(libPath));
250-
PublicDelayLoadDLLs.Add(libPath);
230+
string PythonHome = Path.Combine(Target.UEThirdPartySourceDirectory, "Python3/Mac/include");
231+
PublicIncludePaths.Add(PythonHome);
232+
string LibPath = Path.Combine(Target.UEThirdPartyBinariesDirectory, "Python3/Mac/lib/libpython3.9.dylib");
233+
PublicDelayLoadDLLs.Add(LibPath);
251234
}
252235
else if (Target.Platform == UnrealTargetPlatform.Linux)
253236
{

0 commit comments

Comments
 (0)