mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Turn custom module paths relative to the engine's directory when they reside inside the engine's folder.
This commit is contained in:
parent
b8c81b5449
commit
4ed0f09f43
@ -429,12 +429,21 @@ void unregister_module_types(ModuleRegistrationLevel p_level) {
|
|||||||
def convert_custom_modules_path(path):
|
def convert_custom_modules_path(path):
|
||||||
if not path:
|
if not path:
|
||||||
return path
|
return path
|
||||||
|
|
||||||
path = os.path.realpath(os.path.expanduser(os.path.expandvars(path)))
|
path = os.path.realpath(os.path.expanduser(os.path.expandvars(path)))
|
||||||
err_msg = "Build option 'custom_modules' must %s"
|
err_msg = "Build option 'custom_modules' must %s"
|
||||||
|
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
raise ValueError(err_msg % "point to an existing directory.")
|
raise ValueError(err_msg % "point to an existing directory.")
|
||||||
|
|
||||||
if path == os.path.realpath("modules"):
|
if path == os.path.realpath("modules"):
|
||||||
raise ValueError(err_msg % "be a directory other than built-in `modules` directory.")
|
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
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user