mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-29 04:04:47 +03:00
Changes as requested
This commit is contained in:
@@ -25,8 +25,6 @@ namespace MediaBrowser.Common.Plugins
|
||||
/// </summary>
|
||||
private readonly object _configurationSaveLock = new object();
|
||||
|
||||
private Action<string> _directoryCreateFn;
|
||||
|
||||
/// <summary>
|
||||
/// The configuration.
|
||||
/// </summary>
|
||||
@@ -65,11 +63,6 @@ namespace MediaBrowser.Common.Plugins
|
||||
assemblyPlugin.SetId(assemblyId);
|
||||
}
|
||||
}
|
||||
|
||||
if (this is IHasPluginConfiguration hasPluginConfiguration)
|
||||
{
|
||||
hasPluginConfiguration.SetStartupInfo(s => Directory.CreateDirectory(s));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -145,13 +138,6 @@ namespace MediaBrowser.Common.Plugins
|
||||
/// <value>The configuration.</value>
|
||||
BasePluginConfiguration IHasPluginConfiguration.Configuration => Configuration;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetStartupInfo(Action<string> directoryCreateFn)
|
||||
{
|
||||
// hack alert, until the .net core transition is complete
|
||||
_directoryCreateFn = directoryCreateFn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the current configuration to the file system.
|
||||
/// </summary>
|
||||
@@ -160,7 +146,11 @@ namespace MediaBrowser.Common.Plugins
|
||||
{
|
||||
lock (_configurationSaveLock)
|
||||
{
|
||||
_directoryCreateFn(Path.GetDirectoryName(ConfigurationFilePath));
|
||||
var folder = Path.GetDirectoryName(ConfigurationFilePath);
|
||||
if (!Directory.Exists(folder))
|
||||
{
|
||||
Directory.CreateDirectory(folder);
|
||||
}
|
||||
|
||||
XmlSerializer.SerializeToFile(config, ConfigurationFilePath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user