diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs index 968e4ef1d..45b159574 100644 --- a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs +++ b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs @@ -203,10 +203,12 @@ namespace MediaBrowser.Server.Implementations.Configuration && !string.Equals(Configuration.ItemsByNamePath ?? string.Empty, newPath)) { // Validate - if (!_fileSystem.DirectoryExists(newPath)) + if (!_fileSystem.DirectoryExists(newPath)) { throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath)); } + + EnsureWriteAccess(newPath); } } @@ -223,13 +225,23 @@ namespace MediaBrowser.Server.Implementations.Configuration && !string.Equals(Configuration.MetadataPath ?? string.Empty, newPath)) { // Validate - if (!_fileSystem.DirectoryExists(newPath)) + if (!_fileSystem.DirectoryExists(newPath)) { throw new DirectoryNotFoundException(string.Format("{0} does not exist.", newPath)); } + + EnsureWriteAccess(newPath); } } + private void EnsureWriteAccess(string path) + { + var file = Path.Combine(path, Guid.NewGuid().ToString()); + + _fileSystem.WriteAllText(file, string.Empty); + _fileSystem.DeleteFile(file); + } + public void DisableMetadataService(string service) { DisableMetadataService(typeof(Movie), Configuration, service); |
