From 01e65c93eeeddff27fc2e0e4833678c5cc2829a0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 14 Dec 2013 20:17:57 -0500 Subject: updated live tv + nuget --- .../Configuration/ServerConfigurationManager.cs | 31 ++++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs') 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 /// private void UpdateItemsByNamePath() { - if (!string.IsNullOrEmpty(Configuration.ItemsByNamePath)) - { - ApplicationPaths.ItemsByNamePath = Configuration.ItemsByNamePath; - } + ((ServerApplicationPaths) ApplicationPaths).ItemsByNamePath = string.IsNullOrEmpty(Configuration.ItemsByNamePath) ? + null : + Configuration.ItemsByNamePath; } /// @@ -84,19 +83,29 @@ namespace MediaBrowser.Server.Implementations.Configuration { var newConfig = (ServerConfiguration) newConfiguration; - var newIbnPath = newConfig.ItemsByNamePath; + ValidateItemByNamePath(newConfig); + + base.ReplaceConfiguration(newConfiguration); + } + + /// + /// Replaces the item by name path. + /// + /// The new configuration. + /// + 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); } } } -- cgit v1.2.3