mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-22 15:36:44 +00:00
🐛 修复 windows 下路径问题 (#87)
This commit is contained in:
parent
91a133b694
commit
aa882c3f93
@ -85,9 +85,9 @@ class ModuleInfo:
|
|||||||
if self.relative_path is None:
|
if self.relative_path is None:
|
||||||
return ""
|
return ""
|
||||||
if os.path.isdir(self.relative_path):
|
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)
|
root, _ = os.path.splitext(self.relative_path)
|
||||||
return root.replace(os.sep, ".")
|
return root.replace("/", ".")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.module_name
|
return self.module_name
|
||||||
|
@ -18,9 +18,9 @@ class ModulesManager:
|
|||||||
self.modules_list.clear()
|
self.modules_list.clear()
|
||||||
|
|
||||||
def refresh_list(self, pathname: str):
|
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:
|
for temp_path in path_list:
|
||||||
if temp_path.startswith('__'):
|
if "__" in temp_path:
|
||||||
continue
|
continue
|
||||||
if os.path.isdir(temp_path):
|
if os.path.isdir(temp_path):
|
||||||
self.modules_list.append(ModuleInfo(relative_path=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)
|
Log.warning(f"{self.manager_name}加载 {module_info} 失败", exc)
|
||||||
else:
|
else:
|
||||||
module_name_list.append(module_info.module_name)
|
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))
|
||||||
|
Loading…
Reference in New Issue
Block a user