retry image saving to internal location

This commit is contained in:
Luke Pulverenti
2015-10-06 10:59:42 -04:00
parent 6271ca99c8
commit 49d222a6d5
3 changed files with 53 additions and 19 deletions

View File

@@ -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);