aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Plugins
diff options
context:
space:
mode:
authorGreenback <jimcartlidge@yahoo.co.uk>2020-12-16 23:19:09 +0000
committerGreenback <jimcartlidge@yahoo.co.uk>2020-12-16 23:19:09 +0000
commitd9aaba36ec807b12d58fdf9498ee60574ba44a54 (patch)
tree17cf97dc6b41316699eaef6e0b63740b20e065f9 /Emby.Server.Implementations/Plugins
parent1ed25ebd9a11f3fc1838e347a34621dcde0b7bd5 (diff)
Copy previous plugin settings if they don't exist.
Diffstat (limited to 'Emby.Server.Implementations/Plugins')
-rw-r--r--Emby.Server.Implementations/Plugins/PluginManager.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Plugins/PluginManager.cs b/Emby.Server.Implementations/Plugins/PluginManager.cs
index 26a029f71..e7589a0f9 100644
--- a/Emby.Server.Implementations/Plugins/PluginManager.cs
+++ b/Emby.Server.Implementations/Plugins/PluginManager.cs
@@ -274,6 +274,32 @@ namespace Emby.Server.Implementations
}
}
+ private void CopyFiles(string source, string destination, bool overwrite, string searchPattern)
+ {
+ FileInfo[] files;
+ try
+ {
+ files = new DirectoryInfo(source).GetFiles(searchPattern);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogDebug(ex, "Error retrieving file list.");
+ return;
+ }
+
+ foreach (FileInfo file in files)
+ {
+ try
+ {
+ file.CopyTo(Path.Combine(destination, file.Name), overwrite);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogDebug(ex, "Error copying file {Name}", file.Name);
+ }
+ }
+ }
+
/// <summary>
/// Changes the status of the other versions of the plugin to "Superceded".
/// </summary>
@@ -295,6 +321,9 @@ namespace Emby.Server.Implementations
return;
}
+ // migrate settings across from the last active version if they don't exist.
+ CopyFiles(predecessor.Path, plugin.Path, false, "*.xml");
+
if (predecessor.Manifest.Status == PluginStatus.Active && !ChangePluginState(predecessor, PluginStatus.Superceded))
{
_logger.LogError("Unable to disable version {Version} of {Name}", predecessor.Version, predecessor.Name);