summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-20 13:10:58 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-20 13:10:58 +0000
commit7c38d9e2a5c994b4aad909ca05de7c422d7788a4 (patch)
treee3bcdd39d2883563d84d5cf2ee364bd166e80b3a /src
parentab502692721d3904912577e3aeab6e273d0aee5c (diff)
slightly more correct version
git-svn-id: http://svn.miranda-ng.org/main/trunk@9886 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/database/database.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp
index 0b1b8f8b06..e9f56bac81 100644
--- a/src/modules/database/database.cpp
+++ b/src/modules/database/database.cpp
@@ -247,16 +247,22 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n
if (hFind != INVALID_HANDLE_VALUE) {
do {
// make sure the first hit is actually a *.dat file
- if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && _tcscmp(ffd.cFileName, _T(".")) && _tcscmp(ffd.cFileName, _T(".."))) {
- TCHAR newProfile[MAX_PATH];
- mir_sntprintf(newProfile, MAX_PATH, _T("%s\\%s\\%s.dat"), profiledir, ffd.cFileName, ffd.cFileName);
- if (_taccess(newProfile, 0) != 0)
- continue;
+ if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !_tcscmp(ffd.cFileName, _T(".")) || !_tcscmp(ffd.cFileName, _T("..")))
+ continue;
+ TCHAR newProfile[MAX_PATH];
+ mir_sntprintf(newProfile, MAX_PATH, _T("%s\\%s\\%s.dat"), profiledir, ffd.cFileName, ffd.cFileName);
+ if (_taccess(newProfile, 0) != 0)
+ continue;
+
+ switch (touchDatabase(newProfile, NULL)) {
+ case 0:
+ if (++found == 1 && nodprof)
+ _tcsncpy_s(szProfile, cch, newProfile, _TRUNCATE);
+
+ case EGROKPRF_OBSOLETE:
allfound++;
- if (touchDatabase(newProfile, NULL) == 0)
- if (++found == 1 && nodprof)
- _tcsncpy_s(szProfile, cch, newProfile, _TRUNCATE);
+ break;
}
}
while (FindNextFile(hFind, &ffd));