Revision | 29513 (tree) |
---|---|
Time | 2022-12-23 18:44:20 |
Author | stefankueng |
don't store the temp file path in the CTempFiles singleton, remove the file manually
@@ -8829,7 +8829,7 @@ | ||
8829 | 8829 | { |
8830 | 8830 | CString sDataFilePath = CPathUtils::GetAppDataDirectory(); |
8831 | 8831 | sDataFilePath += L"\\MonitoringData.ini"; |
8832 | - CString sTempfile = CTempFiles::Instance().GetTempFilePathString(); | |
8832 | + CString sTempfile = CTempFiles::Instance().GetTempFilePathString(false); | |
8833 | 8833 | FILE* pFile = nullptr; |
8834 | 8834 | errno_t err = 0; |
8835 | 8835 | int retrycount = 5; |
@@ -8851,11 +8851,15 @@ | ||
8851 | 8851 | { |
8852 | 8852 | if (!MoveFileEx(sTempfile, sDataFilePath, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH)) |
8853 | 8853 | { |
8854 | + DeleteFile(sTempfile); | |
8854 | 8855 | CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": Error copying %s to %s, Error: %u\n", static_cast<LPCWSTR>(sTempfile), static_cast<LPCWSTR>(sDataFilePath), GetLastError()); |
8855 | 8856 | } |
8856 | 8857 | } |
8857 | 8858 | else |
8859 | + { | |
8860 | + DeleteFile(sTempfile); | |
8858 | 8861 | CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) L": Error saving %s - saving failed\n", static_cast<LPCWSTR>(sTempfile)); |
8862 | + } | |
8859 | 8863 | SyncCommand syncCmd; |
8860 | 8864 | syncCmd.Execute(); |
8861 | 8865 | } |