New: Prevent automatic update if UI folder is not writable

This commit is contained in:
Mark McDowall 2016-01-24 19:22:07 -08:00
commit 9f523bb167
3 changed files with 58 additions and 11 deletions

View file

@ -73,9 +73,17 @@ namespace NzbDrone.Core.Update
if (OsInfo.IsWindows || _configFileProvider.UpdateMechanism != UpdateMechanism.Script)
{
if (!_diskProvider.FolderWritable(_appFolderInfo.StartUpFolder))
var startupFolder = _appFolderInfo.StartUpFolder;
var uiFolder = Path.Combine(startupFolder, "UI");
if (!_diskProvider.FolderWritable(startupFolder))
{
throw new UpdateFolderNotWritableException("Cannot install update because startup folder '{0}' is not writable by the user '{1}'.", _appFolderInfo.StartUpFolder, Environment.UserName);
throw new UpdateFolderNotWritableException("Cannot install update because startup folder '{0}' is not writable by the user '{1}'.", startupFolder, Environment.UserName);
}
if (!_diskProvider.FolderWritable(uiFolder))
{
throw new UpdateFolderNotWritableException("Cannot install update because UI folder '{0}' is not writable by the user '{1}'.", uiFolder, Environment.UserName);
}
}