mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
fix(plugin_store): 修复插件模块路径处理逻辑
简化了插件模块路径的赋值逻辑,直接使用插件对象的模块路径,避免不必要的路径分割操作。 同时修复了目标目录判断条件,确保只有在模块路径为根目录时才使用插件名称作为目录。
This commit is contained in:
parent
ef9ba2256f
commit
e4537e7f8f
@ -213,13 +213,9 @@ class StoreManager:
|
|||||||
if plugin_obj := await PluginInfo.get_plugin(
|
if plugin_obj := await PluginInfo.get_plugin(
|
||||||
module=plugin_info.module, plugin_type=PluginType.PARENT
|
module=plugin_info.module, plugin_type=PluginType.PARENT
|
||||||
):
|
):
|
||||||
plugin_info.module_path = ".".join(
|
plugin_info.module_path = plugin_obj.module_path
|
||||||
plugin_obj.module_path.split(".")[:-1]
|
|
||||||
)
|
|
||||||
elif plugin_obj := await PluginInfo.get_plugin(module=plugin_info.module):
|
elif plugin_obj := await PluginInfo.get_plugin(module=plugin_info.module):
|
||||||
plugin_info.module_path = ".".join(
|
plugin_info.module_path = plugin_obj.module_path
|
||||||
plugin_obj.module_path.split(".")[:-1]
|
|
||||||
)
|
|
||||||
return plugin_info, is_external
|
return plugin_info, is_external
|
||||||
|
|
||||||
if is_update:
|
if is_update:
|
||||||
@ -291,7 +287,7 @@ class StoreManager:
|
|||||||
files = [RepoFileInfo(path=f"{replace_module_path}.py", is_dir=False)]
|
files = [RepoFileInfo(path=f"{replace_module_path}.py", is_dir=False)]
|
||||||
if not is_external:
|
if not is_external:
|
||||||
target_dir = BASE_PATH
|
target_dir = BASE_PATH
|
||||||
elif is_dir:
|
elif is_dir and module_path == ".":
|
||||||
target_dir = BASE_PATH / "plugins" / plugin_name
|
target_dir = BASE_PATH / "plugins" / plugin_name
|
||||||
else:
|
else:
|
||||||
target_dir = BASE_PATH / "plugins"
|
target_dir = BASE_PATH / "plugins"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user