Skip to content

Commit d5263ae

Browse files
committed
修复部分情况下插件安装失败后无法重新安装的问题
1 parent 2e9c5f7 commit d5263ae

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

csharp/Framework/PluginManager.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,25 @@ public static Plugin ExtractPlugin(string path, out string folder)
113113
public static void InstallPlugin(Plugin plugin, string folder)
114114
{
115115
var folderName = Path.GetFileName(folder);
116+
var targetFolder = Path.Combine(PluginPath, folderName);
116117
if (Plugins.ContainsKey(plugin.Identifier)) // plugin already exists
117118
{
118119
new DirectoryInfo(Folders[plugin.Identifier]).Delete(true);
119-
Directory.Move(folder, Path.Combine(PluginPath, folderName));
120120
}
121121
else // a new plugin
122122
{
123-
if (Directory.Exists(Path.Combine(PluginPath, folderName)))
123+
if (Directory.Exists(targetFolder))
124124
{
125-
throw new IOException($"试图安装一个新的插件,但其目录名“{folderName}”与已有插件冲突。请联系插件的发布者。");
125+
if (Folders.ContainsValue(targetFolder))
126+
{
127+
throw new IOException($"试图安装一个新的插件,但其目录名“{folderName}”与已有插件冲突。请联系插件的发布者。");
128+
}
129+
new DirectoryInfo(targetFolder).Delete(true);
126130
}
127-
Directory.Move(folder, Path.Combine(PluginPath, folderName));
128131
}
132+
Directory.Move(folder, targetFolder);
129133
Plugins[plugin.Identifier] = plugin;
130-
Folders[plugin.Identifier] = folder;
134+
Folders[plugin.Identifier] = targetFolder;
131135
}
132136
}
133137
}

csharp/GUI/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.1.0.1")]
55-
[assembly: AssemblyFileVersion("1.1.0.1")]
54+
[assembly: AssemblyVersion("1.1.1.0")]
55+
[assembly: AssemblyFileVersion("1.1.1.0")]

0 commit comments

Comments
 (0)