Delete old files during update

This commit is contained in:
kaso17 2017-01-28 07:08:28 +01:00
parent 8a149ebe47
commit 85bb2dba34
1 changed files with 27 additions and 1 deletions

View File

@ -155,7 +155,7 @@ namespace Jackett.Updater
}
}
// delete old files
// delete old dirs
string[] oldDirs = new string[] { "Content/logos" };
foreach (var oldDir in oldDirs)
@ -175,6 +175,32 @@ namespace Jackett.Updater
}
}
// delete old files
string[] oldFiles = new string[] {
"Content/css/jquery.dataTables.css",
"Content/css/jquery.dataTables_themeroller.css",
"Definitions/tspate.yml",
"Definitions/freakstrackingsystem.yml",
};
foreach (var oldFIle in oldFiles)
{
try
{
var deleteFile = Path.Combine(options.Path, oldFIle);
if (File.Exists(deleteFile))
{
Engine.Logger.Info("Deleting file " + deleteFile);
File.Delete(deleteFile);
}
}
catch (Exception e)
{
Engine.Logger.Error(e);
}
}
// kill pids after the update on UNIX
if (!isWindows)
KillPids(pids);