diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-12-14 20:17:57 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-12-14 20:17:57 -0500 |
| commit | 01e65c93eeeddff27fc2e0e4833678c5cc2829a0 (patch) | |
| tree | 628d2359e6d723c8f9f8865104e518add252bee1 /MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs | |
| parent | d576108411d254afcbefa627cea6a2d3585ab823 (diff) | |
updated live tv + nuget
Diffstat (limited to 'MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs | 31 |
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); } } } |
