mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: fix plugins loader error on windows
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
faef0b0699
commit
a6b69228e8
1 changed files with 5 additions and 5 deletions
|
|
@ -881,15 +881,15 @@ class Client(Methods):
|
||||||
root.replace(".", "/"), path.replace(".", "/")
|
root.replace(".", "/"), path.replace(".", "/")
|
||||||
)
|
)
|
||||||
if handler is None:
|
if handler is None:
|
||||||
exclude_plugins.append(module_path.replace("/", "."))
|
exclude_plugins.append(module_path.replace("/", ".").replace("\\", "."))
|
||||||
else:
|
else:
|
||||||
exclude_handlers[module_path.replace("/", ".")] = handler
|
exclude_handlers[module_path.replace("/", ".").replace("\\", ".")] = handler
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
if not include:
|
if not include:
|
||||||
for current_root, dirnames, filenames in os.walk(root.replace(".", "/")):
|
for current_root, dirnames, filenames in os.walk(root.replace(".", "/")):
|
||||||
namespace = current_root.replace("/", ".")
|
namespace = current_root.replace("/", ".").replace("\\", ".")
|
||||||
if "__pycache__" in namespace:
|
if "__pycache__" in namespace:
|
||||||
continue
|
continue
|
||||||
if namespace in exclude_plugins:
|
if namespace in exclude_plugins:
|
||||||
|
|
@ -957,7 +957,7 @@ class Client(Methods):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
for path, handlers in include:
|
for path, handlers in include:
|
||||||
module_path = root.replace("/", ".") + "." + path
|
module_path = root.replace("/", ".").replace("\\", ".") + "." + path
|
||||||
if self.is_excluded(exclude_plugins, module_path):
|
if self.is_excluded(exclude_plugins, module_path):
|
||||||
log.warning(
|
log.warning(
|
||||||
'[%s] [LOAD] Ignoring namespace "%s"', self.name, module_path
|
'[%s] [LOAD] Ignoring namespace "%s"', self.name, module_path
|
||||||
|
|
@ -978,7 +978,7 @@ class Client(Methods):
|
||||||
|
|
||||||
if "__path__" in dir(module):
|
if "__path__" in dir(module):
|
||||||
for current_root, _, filenames in os.walk(module_path.replace(".", "/")):
|
for current_root, _, filenames in os.walk(module_path.replace(".", "/")):
|
||||||
namespace = current_root.replace("/", ".")
|
namespace = current_root.replace("/", ".").replace("\\", ".")
|
||||||
if "__pycache__" in namespace:
|
if "__pycache__" in namespace:
|
||||||
continue
|
continue
|
||||||
if namespace in exclude_plugins:
|
if namespace in exclude_plugins:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue