|
|
@ -448,10 +448,26 @@ namespace MediaBrowser.Installer
|
|
|
|
var systemDir = Path.Combine(RootPath, "System");
|
|
|
|
var systemDir = Path.Combine(RootPath, "System");
|
|
|
|
var backupDir = Path.Combine(RootPath, "System.old");
|
|
|
|
var backupDir = Path.Combine(RootPath, "System.old");
|
|
|
|
if (Directory.Exists(systemDir))
|
|
|
|
if (Directory.Exists(systemDir))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (Directory.Exists(backupDir)) Directory.Delete(backupDir,true);
|
|
|
|
if (Directory.Exists(backupDir)) Directory.Delete(backupDir,true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new ApplicationException("Could not delete previous backup directory.\n\n"+e.Message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
Directory.Move(systemDir, backupDir);
|
|
|
|
Directory.Move(systemDir, backupDir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new ApplicationException("Could not move system directory to backup.\n\n"+e.Message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// And extract
|
|
|
|
// And extract
|
|
|
|
var retryCount = 0;
|
|
|
|
var retryCount = 0;
|
|
|
@ -469,7 +485,7 @@ namespace MediaBrowser.Installer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (retryCount < 3)
|
|
|
|
if (retryCount < 3)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -480,8 +496,8 @@ namespace MediaBrowser.Installer
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//Rollback
|
|
|
|
//Rollback
|
|
|
|
RollBack(systemDir, backupDir);
|
|
|
|
RollBack(systemDir, backupDir);
|
|
|
|
File.Delete(archive); // so we don't try again if its an update
|
|
|
|
TryDelete(archive); // so we don't try again if its an update
|
|
|
|
throw;
|
|
|
|
throw new ApplicationException(string.Format("Could not extract {0} to {1} after {2} attempts.\n\n{3}", archive, RootPath, retryCount, e.Message));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|