fix(plugin_store): 修复插件模块路径处理逻辑

简化了插件模块路径的赋值逻辑,直接使用插件对象的模块路径,避免不必要的路径分割操作。
同时修复了目标目录判断条件,确保只有在模块路径为根目录时才使用插件名称作为目录。
This commit is contained in:
molanp 2025-09-26 21:08:59 +08:00
parent ef9ba2256f
commit e4537e7f8f

View File

@ -213,13 +213,9 @@ class StoreManager:
if plugin_obj := await PluginInfo.get_plugin(
module=plugin_info.module, plugin_type=PluginType.PARENT
):
plugin_info.module_path = ".".join(
plugin_obj.module_path.split(".")[:-1]
)
plugin_info.module_path = plugin_obj.module_path
elif plugin_obj := await PluginInfo.get_plugin(module=plugin_info.module):
plugin_info.module_path = ".".join(
plugin_obj.module_path.split(".")[:-1]
)
plugin_info.module_path = plugin_obj.module_path
return plugin_info, is_external
if is_update:
@ -291,7 +287,7 @@ class StoreManager:
files = [RepoFileInfo(path=f"{replace_module_path}.py", is_dir=False)]
if not is_external:
target_dir = BASE_PATH
elif is_dir:
elif is_dir and module_path == ".":
target_dir = BASE_PATH / "plugins" / plugin_name
else:
target_dir = BASE_PATH / "plugins"