|
@@ -134,7 +134,26 @@ namespace MediaBrowser.Common.Plugins
|
|
var assemblyName = assembly.GetName();
|
|
var assemblyName = assembly.GetName();
|
|
var assemblyFilePath = assembly.Location;
|
|
var assemblyFilePath = assembly.Location;
|
|
|
|
|
|
- var dataFolderPath = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(assemblyFilePath));
|
|
|
|
|
|
+ // Find out the plugin folder.
|
|
|
|
+ bool inPluginFolder = assemblyFilePath.StartsWith(ApplicationPaths.PluginsPath, StringComparison.OrdinalIgnoreCase);
|
|
|
|
+ string path, dataFolderPath;
|
|
|
|
+
|
|
|
|
+ var configurationFileName = Path.ChangeExtension(Path.GetFileName(assemblyFilePath), ".xml");
|
|
|
|
+ if (inPluginFolder)
|
|
|
|
+ {
|
|
|
|
+ // Normal plugin.
|
|
|
|
+ path = assemblyFilePath.Substring(ApplicationPaths.PluginsPath.Length).Split('\\', StringSplitOptions.RemoveEmptyEntries)[0];
|
|
|
|
+ dataFolderPath = Path.Combine(
|
|
|
|
+ Path.Combine(ApplicationPaths.PluginsPath, path),
|
|
|
|
+ configurationFileName);
|
|
|
|
+ ConfigurationFilePath = dataFolderPath;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ // Provider
|
|
|
|
+ dataFolderPath = Path.Combine(ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(assemblyFilePath));
|
|
|
|
+ ConfigurationFilePath = Path.Combine(ApplicationPaths.PluginConfigurationsPath, configurationFileName);
|
|
|
|
+ }
|
|
|
|
|
|
assemblyPlugin.SetAttributes(assemblyFilePath, dataFolderPath, assemblyName.Version);
|
|
assemblyPlugin.SetAttributes(assemblyFilePath, dataFolderPath, assemblyName.Version);
|
|
|
|
|
|
@@ -146,6 +165,25 @@ namespace MediaBrowser.Common.Plugins
|
|
|
|
|
|
assemblyPlugin.SetId(assemblyId);
|
|
assemblyPlugin.SetId(assemblyId);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // TODO : Simplify this, once migration support is ceased.
|
|
|
|
+ if (inPluginFolder)
|
|
|
|
+ {
|
|
|
|
+ var oldConfigFilePath = Path.Combine(ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName);
|
|
|
|
+
|
|
|
|
+ if (!File.Exists(ConfigurationFilePath) && File.Exists(oldConfigFilePath))
|
|
|
|
+ {
|
|
|
|
+ // Migrate settings, as different plugin versions may have different settings.
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ File.Copy(oldConfigFilePath, ConfigurationFilePath);
|
|
|
|
+ }
|
|
|
|
+ catch
|
|
|
|
+ {
|
|
|
|
+ // Unable to migrate settings.
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (this is IHasPluginConfiguration hasPluginConfiguration)
|
|
if (this is IHasPluginConfiguration hasPluginConfiguration)
|
|
@@ -219,7 +257,7 @@ namespace MediaBrowser.Common.Plugins
|
|
/// Gets the full path to the configuration file.
|
|
/// Gets the full path to the configuration file.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The configuration file path.</value>
|
|
/// <value>The configuration file path.</value>
|
|
- public string ConfigurationFilePath => Path.Combine(ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName);
|
|
|
|
|
|
+ public string ConfigurationFilePath { get; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the plugin configuration.
|
|
/// Gets the plugin configuration.
|