@ -60,6 +60,7 @@ namespace MediaBrowser.Server.Implementations.Configuration
protected override void OnConfigurationUpdated ( )
{
UpdateItemsByNamePath ( ) ;
UpdateTranscodingTempPath ( ) ;
base . OnConfigurationUpdated ( ) ;
}
@ -74,6 +75,16 @@ namespace MediaBrowser.Server.Implementations.Configuration
Configuration . ItemsByNamePath ;
}
/// <summary>
/// Updates the transcoding temporary path.
/// </summary>
private void UpdateTranscodingTempPath ( )
{
( ( ServerApplicationPaths ) ApplicationPaths ) . TranscodingTempPath = string . IsNullOrEmpty ( Configuration . TranscodingTempPath ) ?
null :
Configuration . TranscodingTempPath ;
}
/// <summary>
/// Replaces the configuration.
/// </summary>
@ -84,6 +95,7 @@ namespace MediaBrowser.Server.Implementations.Configuration
var newConfig = ( ServerConfiguration ) newConfiguration ;
ValidateItemByNamePath ( newConfig ) ;
ValidateTranscodingTempPath ( newConfig ) ;
base . ReplaceConfiguration ( newConfiguration ) ;
}
@ -107,5 +119,25 @@ namespace MediaBrowser.Server.Implementations.Configuration
}
}
}
/// <summary>
/// Validates the transcoding temporary path.
/// </summary>
/// <param name="newConfig">The new configuration.</param>
/// <exception cref="DirectoryNotFoundException"></exception>
private void ValidateTranscodingTempPath ( ServerConfiguration newConfig )
{
var newPath = newConfig . TranscodingTempPath ;
if ( ! string . IsNullOrWhiteSpace ( newPath )
& & ! string . Equals ( Configuration . TranscodingTempPath ? ? string . Empty , newPath ) )
{
// Validate
if ( ! Directory . Exists ( newPath ) )
{
throw new DirectoryNotFoundException ( string . Format ( "{0} does not exist." , newPath ) ) ;
}
}
}
}
}