diff --git a/models/base.py b/models/base.py index 4d82dc41..635af3dc 100644 --- a/models/base.py +++ b/models/base.py @@ -85,9 +85,9 @@ class ModuleInfo: if self.relative_path is None: return "" if os.path.isdir(self.relative_path): - return self.relative_path.replace(os.sep, ".") + return self.relative_path.replace("/", ".") root, _ = os.path.splitext(self.relative_path) - return root.replace(os.sep, ".") + return root.replace("/", ".") def __str__(self): return self.module_name diff --git a/utils/manager.py b/utils/manager.py index af745447..28afc0d7 100644 --- a/utils/manager.py +++ b/utils/manager.py @@ -18,9 +18,9 @@ class ModulesManager: self.modules_list.clear() def refresh_list(self, pathname: str): - path_list = glob(pathname) + path_list = [i.replace(os.sep, "/") for i in glob(pathname)] for temp_path in path_list: - if temp_path.startswith('__'): + if "__" in temp_path: continue if os.path.isdir(temp_path): self.modules_list.append(ModuleInfo(relative_path=temp_path)) @@ -52,4 +52,4 @@ class ModulesManager: Log.warning(f"{self.manager_name}加载 {module_info} 失败", exc) else: module_name_list.append(module_info.module_name) - Log.info(self.manager_name + "加载模块: " + ", ".join(module_name_list)) + Log.info(f"{self.manager_name}加载模块: " + ", ".join(module_name_list))