From 08711274c7c3f405c5ae1a8f4c0192a75c844f9e Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 17 Feb 2024 16:41:51 +0100 Subject: [PATCH] Fix custom module paths for the editor builds. --- SConstruct | 7 ++++++- methods.py | 2 +- modules/SCsub | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index 81ef3b0ae..40aa3bc06 100644 --- a/SConstruct +++ b/SConstruct @@ -295,7 +295,12 @@ for path in module_search_paths: # from the built-in "modules" name (e.g. "custom_modules/summator/summator.h"), # so it can be referenced simply as `#include "summator/summator.h"` # independently of where a module is located on user's filesystem. - env_base.Prepend(CPPPATH=[path, os.path.dirname(path)]) + + if not os.path.isabs(path): + env_base.Prepend(CPPPATH=["#" + path, "#" + os.path.dirname(path)]) + else: + env_base.Prepend(CPPPATH=[path, os.path.dirname(path)]) + # Note: custom modules can override built-in ones. modules_detected.update(modules) diff --git a/methods.py b/methods.py index 2828d5dfa..6ae22a84f 100644 --- a/methods.py +++ b/methods.py @@ -439,7 +439,7 @@ def convert_custom_modules_path(path): if path == os.path.realpath("modules"): raise ValueError(err_msg % "be a directory other than built-in `modules` directory.") - current_path = os.path.realpath(".") + current_path = os.path.realpath(".") + "/" if path.startswith(current_path): path = path.replace(current_path, "", 1) diff --git a/modules/SCsub b/modules/SCsub index 678a614c9..133dd5ca1 100644 --- a/modules/SCsub +++ b/modules/SCsub @@ -17,8 +17,12 @@ env.modules_sources = [] env_modules.add_source_files(env.modules_sources, "register_module_types.gen.cpp") for name, path in env.module_list.items(): + if not os.path.isabs(path): - SConscript(name + "/SCsub") # Built-in. + if path.startswith("modules/"): + SConscript(name + "/SCsub") # Built-in. + else: + SConscript("../" + path + "/SCsub") # In the engine's folder, so start from there else: SConscript(path + "/SCsub") # Custom.