summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-17 10:16:29 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-17 10:16:29 +0000
commita28aad9bda9b24df099cc5bf001c4cb4d4740d75 (patch)
treec3d386a53b8b6acbf93a2da8a615c66ab5b73379 /src
parent2fdeda5e62e8077d0dbc02e95b95752a7e850ebe (diff)
fix for updating miranda
git-svn-id: http://svn.miranda-ng.org/main/trunk@14231 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/miranda32/src/checker.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/miranda32/src/checker.cpp b/src/miranda32/src/checker.cpp
index 4e1a2a9b95..c6371a20f1 100644
--- a/src/miranda32/src/checker.cpp
+++ b/src/miranda32/src/checker.cpp
@@ -173,6 +173,29 @@ int SafeCreateDirectory(const TCHAR *pFolder)
/////////////////////////////////////////////////////////////////////////////////////////
+bool TryDeleteFile(const TCHAR *ptszFileName)
+{
+ for (int i = 0; i < 5; i++) {
+ if (SafeDeleteFile(ptszFileName))
+ return true;
+
+ switch (GetLastError()) {
+ case ERROR_ACCESS_DENIED:
+ case ERROR_SHARING_VIOLATION:
+ case ERROR_LOCK_VIOLATION:
+ break;
+
+ default:
+ return false;
+ }
+
+ Sleep(200);
+ }
+ return false;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
bool CheckDlls(const TCHAR *ptszPath)
{
// ptszPath - slash-terminated string
@@ -201,7 +224,7 @@ LBL_Error: MessageBox(NULL, _T("Miranda failed to delete the obsolete file. Do i
bInit = true;
}
- if (!SafeDeleteFile(findData.cFileName))
+ if (!TryDeleteFile(findData.cFileName))
goto LBL_Error;
}
while (FindNextFile(hSearch, &findData));