Turn custom module paths relative to the engine's directory when they reside inside the engine's folder.

This commit is contained in:
Relintai 2024-02-17 15:11:13 +01:00
parent b8c81b5449
commit 4ed0f09f43

View File

@ -429,12 +429,21 @@ void unregister_module_types(ModuleRegistrationLevel p_level) {
def convert_custom_modules_path(path):
if not path:
return path
path = os.path.realpath(os.path.expanduser(os.path.expandvars(path)))
err_msg = "Build option 'custom_modules' must %s"
if not os.path.isdir(path):
raise ValueError(err_msg % "point to an existing directory.")
if path == os.path.realpath("modules"):
raise ValueError(err_msg % "be a directory other than built-in `modules` directory.")
current_path = os.path.realpath(".")
if path.startswith(current_path):
path = path.replace(current_path, "", 1)
return path