diff --git a/UpdCheck/main.cpp b/UpdCheck/main.cpp index e8e8b09..a1810c6 100644 --- a/UpdCheck/main.cpp +++ b/UpdCheck/main.cpp @@ -365,7 +365,8 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In param += wxT("\""); // 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 += fileNameLog; @@ -380,9 +381,18 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In } } else wxLogWarning(wxT("Update package file download failed.")); - } else + } else { 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. initializer.m_config.Write(wxT("LastChecked"), (long)wxDateTime::GetTimeNow()); diff --git a/UpdCheck/stdafx.h b/UpdCheck/stdafx.h index bfa9a30..5a10942 100644 --- a/UpdCheck/stdafx.h +++ b/UpdCheck/stdafx.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include