Update package cleanup added

This commit is contained in:
Simon Rozman 2016-03-29 15:32:12 +02:00
parent ada90646ac
commit a5f71f6965
2 changed files with 13 additions and 2 deletions

View File

@ -365,7 +365,8 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In
param += wxT("\""); param += wxT("\"");
// Logging // Logging
wxString fileNameLog(initializer.m_path + wxT("Updater-") wxT(UPDATER_CFG_APPLICATION) wxT("-msiexec.log")); wxString fileNameLog(initializer.m_path);
fileNameLog += wxT("Updater-") wxT(UPDATER_CFG_APPLICATION) wxT("-msiexec.log");
param += wxT(" /l* \""); param += wxT(" /l* \"");
param += fileNameLog; param += fileNameLog;
@ -380,9 +381,18 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In
} }
} else } else
wxLogWarning(wxT("Update package file download failed.")); wxLogWarning(wxT("Update package file download failed."));
} else } else {
wxLogStatus(wxT("Update check complete. Your package is up to date.")); wxLogStatus(wxT("Update check complete. Your package is up to date."));
// Clean-up the downloaded package files to free space.
wxDir dir(initializer.m_path);
if (dir.IsOpened()) {
wxString filename;
for (bool cont = dir.GetFirst(&filename, wxT("Updater-") wxT(UPDATER_CFG_APPLICATION) wxT("-*.msi"), wxDIR_FILES | wxDIR_HIDDEN); cont; cont = dir.GetNext(&filename))
wxRemoveFile(initializer.m_path + filename);
}
}
// Save the last check date. // Save the last check date.
initializer.m_config.Write(wxT("LastChecked"), (long)wxDateTime::GetTimeNow()); initializer.m_config.Write(wxT("LastChecked"), (long)wxDateTime::GetTimeNow());

View File

@ -28,6 +28,7 @@
#include <wx/base64.h> #include <wx/base64.h>
#include <wx/config.h> #include <wx/config.h>
#include <wx/datetime.h> #include <wx/datetime.h>
#include <wx/dir.h>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/protocol/http.h> #include <wx/protocol/http.h>
#include <wx/url.h> #include <wx/url.h>