diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-20 13:32:19 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-20 13:32:19 +0000 |
commit | 2d3b85b61fbd644508fac957e194a1618830191b (patch) | |
tree | 1ca78627152f480d97239161321741bd36b21503 /src/modules/database/database.cpp | |
parent | 7c38d9e2a5c994b4aad909ca05de7c422d7788a4 (diff) |
default profile verification
git-svn-id: http://svn.miranda-ng.org/main/trunk@9887 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/database/database.cpp')
-rw-r--r-- | src/modules/database/database.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index e9f56bac81..4b496dca48 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -231,7 +231,7 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n moveProfileDirProfiles(profiledir);
moveProfileDirProfiles(profiledir, FALSE);
- bool nodprof = szProfile[0] == 0;
+ bool nodprof = (*szProfile == 0);
bool reqfd = !nodprof && (_taccess(szProfile, 0) == 0 || shouldAutoCreate(szProfile));
bool shpm = showProfileManager();
@@ -269,11 +269,11 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n FindClose(hFind);
}
- reqfd = !shpm && found == 1 && nodprof;
+ reqfd = (!shpm && found == 1 && nodprof);
}
if (noProfiles)
- *noProfiles = allfound == 0;
+ *noProfiles = (allfound == 0);
if (nodprof && !reqfd)
szProfile[0] = 0;
@@ -284,6 +284,9 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n // returns 1 if a default profile should be selected instead of showing the manager.
static int getProfileAutoRun(TCHAR *szProfile)
{
+ if (*szProfile == 0)
+ return false;
+
TCHAR Mgr[32];
GetPrivateProfileString(_T("Database"), _T("ShowProfileMgr"), _T(""), Mgr, SIZEOF(Mgr), mirandabootini);
if (_tcsicmp(Mgr, _T("never")))
@@ -303,6 +306,12 @@ static int getProfile(TCHAR *szProfile, size_t cch) getDefaultProfile(szProfile, cch, g_profileDir);
getProfileCmdLine(szProfile, cch, g_profileDir);
getProfileDefault(szProfile, cch, g_profileDir);
+
+ // if default profile was found, verify it
+ if (*szProfile)
+ if (touchDatabase(szProfile, 0) != 0)
+ *szProfile = 0;
+
if (IsInsideRootDir(g_profileDir, true)) {
MessageBox(NULL,
TranslateT("Profile cannot be placed into Miranda root folder.\nPlease move Miranda profile to some other location."),
|