diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-10-06 10:59:42 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-10-06 10:59:42 -0400 |
| commit | 49d222a6d56560cbadf3df72d16499789d5ceaea (patch) | |
| tree | 16e27ecd2fa22c85e560e633adcb706f9ecdb261 /MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs | |
| parent | 6271ca99c8cdb36c1e8674bdd203e31a2d5a1fe1 (diff) | |
retry image saving to internal location
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); |
