Fix custom module paths for the editor builds.

This commit is contained in:
Relintai 2024-02-17 16:41:51 +01:00
parent 4ed0f09f43
commit 08711274c7
3 changed files with 12 additions and 3 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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.