aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs31
1 files changed, 20 insertions, 11 deletions
diff --git a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
index 8165e11eb..94438e3e0 100644
--- a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
+++ b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
@@ -69,10 +69,9 @@ namespace MediaBrowser.Server.Implementations.Configuration
/// </summary>
private void UpdateItemsByNamePath()
{
- if (!string.IsNullOrEmpty(Configuration.ItemsByNamePath))
- {
- ApplicationPaths.ItemsByNamePath = Configuration.ItemsByNamePath;
- }
+ ((ServerApplicationPaths) ApplicationPaths).ItemsByNamePath = string.IsNullOrEmpty(Configuration.ItemsByNamePath) ?
+ null :
+ Configuration.ItemsByNamePath;
}
/// <summary>
@@ -84,19 +83,29 @@ namespace MediaBrowser.Server.Implementations.Configuration
{
var newConfig = (ServerConfiguration) newConfiguration;
- var newIbnPath = newConfig.ItemsByNamePath;
+ ValidateItemByNamePath(newConfig);
+
+ base.ReplaceConfiguration(newConfiguration);
+ }
+
+ /// <summary>
+ /// Replaces the item by name path.
+ /// </summary>
+ /// <param name="newConfig">The new configuration.</param>
+ /// <exception cref="System.IO.DirectoryNotFoundException"></exception>
+ private void ValidateItemByNamePath(ServerConfiguration newConfig)
+ {
+ var newPath = newConfig.ItemsByNamePath;
- if (!string.IsNullOrWhiteSpace(newIbnPath)
- && !string.Equals(Configuration.ItemsByNamePath ?? string.Empty, newIbnPath))
+ if (!string.IsNullOrWhiteSpace(newPath)
+ && !string.Equals(Configuration.ItemsByNamePath ?? string.Empty, newPath))
{
// Validate
- if (!Directory.Exists(newIbnPath))
+ if (!Directory.Exists(newPath))
{
- throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newConfig.ItemsByNamePath));
+ throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath));
}
}
-
- base.ReplaceConfiguration(newConfiguration);
}
}
}