diff --git a/SConstruct b/SConstruct index 81ef3b0ae9..40aa3bc063 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 2828d5dfa4..6ae22a84fd 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 678a614c95..133dd5ca1d 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.