pyrofork: fix plugins loader error on windows

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2024-10-04 00:11:34 +07:00
parent faef0b0699
commit a6b69228e8
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -881,15 +881,15 @@ class Client(Methods):
root.replace(".", "/"), path.replace(".", "/")
)
if handler is None:
exclude_plugins.append(module_path.replace("/", "."))
exclude_plugins.append(module_path.replace("/", ".").replace("\\", "."))
else:
exclude_handlers[module_path.replace("/", ".")] = handler
exclude_handlers[module_path.replace("/", ".").replace("\\", ".")] = handler
count = 0
if not include:
for current_root, dirnames, filenames in os.walk(root.replace(".", "/")):
namespace = current_root.replace("/", ".")
namespace = current_root.replace("/", ".").replace("\\", ".")
if "__pycache__" in namespace:
continue
if namespace in exclude_plugins:
@ -957,7 +957,7 @@ class Client(Methods):
pass
else:
for path, handlers in include:
module_path = root.replace("/", ".") + "." + path
module_path = root.replace("/", ".").replace("\\", ".") + "." + path
if self.is_excluded(exclude_plugins, module_path):
log.warning(
'[%s] [LOAD] Ignoring namespace "%s"', self.name, module_path
@ -978,7 +978,7 @@ class Client(Methods):
if "__path__" in dir(module):
for current_root, _, filenames in os.walk(module_path.replace(".", "/")):
namespace = current_root.replace("/", ".")
namespace = current_root.replace("/", ".").replace("\\", ".")
if "__pycache__" in namespace:
continue
if namespace in exclude_plugins: