New: Health check for AppData and Startup folder conflict

This commit is contained in:
Mark McDowall 2014-06-07 12:19:37 -07:00
commit ebd13bdda8
7 changed files with 131 additions and 7 deletions

View file

@ -60,6 +60,8 @@ namespace NzbDrone.Core.Update
{
try
{
EnsureAppDataSafety();
var updateSandboxFolder = _appFolderInfo.GetUpdateSandboxFolder();
var packageDestination = Path.Combine(updateSandboxFolder, updatePackage.FileName);
@ -139,6 +141,15 @@ namespace NzbDrone.Core.Update
return String.Join(" ", processId, updateSandboxFolder.TrimEnd(Path.DirectorySeparatorChar).WrapInQuotes(), executingApplication.WrapInQuotes());
}
private void EnsureAppDataSafety()
{
if (_appFolderInfo.StartUpFolder.IsParentPath(_appFolderInfo.AppDataFolder) ||
_appFolderInfo.StartUpFolder.PathEquals(_appFolderInfo.AppDataFolder))
{
throw new NotSupportedException("Update will cause AppData to be deleted, correct you configuration before proceeding");
}
}
public void Execute(ApplicationUpdateCommand message)
{
_logger.ProgressDebug("Checking for updates");