mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-08 12:09:40 +00:00
Fixed plugin installation and endless plugin reloading on Linux (#924)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
This commit is contained in:
1 parent
01f25b2bc0
commit
8148b66876
15 files changed
+402
-95
No files matched your search
@@ -16,16 +16,19 @@ public sealed partial class PluginInstallService
|
||||
var replacedExisting = false;
|
||||
var movedIntoPlace = false;
|
||||
|
||||
// We reload the plugins ourselves below. Holding back hot reloading keeps the file system
|
||||
// watcher from starting a second reload while the plugin is being moved into place:
|
||||
await PluginFactory.LockHotReloadAsync();
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(pluginRoot);
|
||||
finalDirectory = DetermineFinalDirectory(pluginRoot, plugin, pluginType);
|
||||
if (!IsPathInsideDirectory(pluginRoot, finalDirectory))
|
||||
return Error(TB("The resolved plugin directory is outside the plugin directory."));
|
||||
return Error(plugin, finalDirectory, TB("The resolved plugin directory is outside the plugin directory."));
|
||||
|
||||
var replacementIssue = GetReplacementIssue(plugin.Id, pluginType);
|
||||
if (!string.IsNullOrWhiteSpace(replacementIssue))
|
||||
return Error(replacementIssue);
|
||||
return Error(plugin, finalDirectory, replacementIssue);
|
||||
|
||||
if (Directory.Exists(finalDirectory))
|
||||
{
|
||||
@@ -36,10 +39,10 @@ public sealed partial class PluginInstallService
|
||||
// would be loaded a second time, next to the version we are installing:
|
||||
backupDirectory = CreateInstallBackupDirectory(plugin);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(backupDirectory)!);
|
||||
Directory.Move(finalDirectory, backupDirectory);
|
||||
this.MoveDirectory(finalDirectory, backupDirectory);
|
||||
}
|
||||
|
||||
Directory.Move(stagingDirectory, finalDirectory);
|
||||
this.MoveDirectory(stagingDirectory, finalDirectory);
|
||||
movedIntoPlace = true;
|
||||
await PluginFactory.LoadAll(token);
|
||||
|
||||
@@ -51,7 +54,7 @@ public sealed partial class PluginInstallService
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
this.logger.LogError(e, "Failed to install plugin.");
|
||||
this.logger.LogError(e, "Failed to install the {PluginType} plugin '{PluginName}' ({PluginId}) into '{PluginDirectory}'.", pluginType, plugin.Name, plugin.Id, finalDirectory);
|
||||
|
||||
// Only remove the target directory when this installation actually moved the plugin
|
||||
// there. Otherwise, when moving the previous plugin into the backup directory failed,
|
||||
@@ -63,7 +66,7 @@ public sealed partial class PluginInstallService
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.Move(backupDirectory, finalDirectory);
|
||||
this.MoveDirectory(backupDirectory, finalDirectory);
|
||||
await PluginFactory.LoadAll(CancellationToken.None);
|
||||
}
|
||||
catch (Exception restoreException)
|
||||
@@ -72,11 +75,12 @@ public sealed partial class PluginInstallService
|
||||
}
|
||||
}
|
||||
|
||||
return Error(string.Format(TB("Unexpected error: {0}"), e.Message));
|
||||
return Error(plugin, finalDirectory ?? string.Empty, string.Format(TB("Unexpected error: {0}"), e.Message));
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.TryDeleteStagingDirectory(stagingDirectory);
|
||||
PluginFactory.UnlockHotReload();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user