summaryrefslogtreecommitdiff
path: root/onlineupdate
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-11 03:46:04 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-06-11 03:57:55 +0200
commitbad96903a39ab37a1feee483e98ac16560b94d2b (patch)
tree8bfb32f92d11c394c9056035dd80364531ceded4 /onlineupdate
parent38b3fb2a9354989db1fa8909bae163b282066f69 (diff)
fix automatic updates with user profile in installation dir
Change-Id: Ice8b73b1e80ce48e14be854b29b55c037b34f981
Diffstat (limited to 'onlineupdate')
-rw-r--r--onlineupdate/source/update/updater/updater.cxx32
1 files changed, 19 insertions, 13 deletions
diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index f1800448087f..629e19e33c0c 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -2360,16 +2360,6 @@ ProcessReplaceRequest()
NS_tsnprintf(tmpDir, sizeof(tmpDir)/sizeof(tmpDir[0]),
NS_T("%s.bak"), destDir);
- NS_tchar newDir[MAXPATHLEN];
- NS_tsnprintf(newDir, sizeof(newDir)/sizeof(newDir[0]),
-#ifdef MACOSX
- NS_T("%s/Contents"),
- gWorkingDirPath);
-#else
- NS_T("%s"),
- gWorkingDirPath);
-#endif
-
// First try to remove the possibly existing temp directory, because if this
// directory exists, we will fail to rename destDir.
// No need to error check here because if this fails, we will fail in the
@@ -2378,6 +2368,7 @@ ProcessReplaceRequest()
LOG(("Begin moving destDir (" LOG_S ") to tmpDir (" LOG_S ")",
destDir, tmpDir));
+ LogFlush();
int rv = rename_file(destDir, tmpDir, true);
#ifdef _WIN32
// On Windows, if Firefox is launched using the shortcut, it will hold a handle
@@ -2405,6 +2396,21 @@ ProcessReplaceRequest()
return rv;
}
+ NS_tchar newDir[MAXPATHLEN];
+ if (is_userprofile_in_instdir())
+ {
+ LOG(("user profile in instdir"));
+ NS_tstrcpy(newDir, tmpDir);
+ NS_tstrcat(newDir, gWorkingDirPath + NS_tstrlen(gInstallDirPath));
+ LOG((LOG_S, newDir));
+ }
+ else
+ {
+ NS_tsnprintf(newDir, sizeof(newDir)/sizeof(newDir[0]),
+ NS_T("%s"),
+ gWorkingDirPath);
+ }
+
LOG(("Begin moving newDir (" LOG_S ") to destDir (" LOG_S ")",
newDir, destDir));
rv = rename_file(newDir, destDir, true);
@@ -2440,21 +2446,21 @@ ProcessReplaceRequest()
NS_tchar userprofile[MAXPATHLEN];
NS_tstrcpy(userprofile, gPatchDirPath);
- NS_tchar *slash = (NS_tchar *) NS_tstrrchr(userprofile, NS_T('/'));
+ NS_tchar* slash = (NS_tchar *) NS_tstrrchr(userprofile, NS_T('/'));
if (slash)
*slash = NS_T('\0');
NS_tstrcpy(backup_user_profile, tmpDir);
size_t installdir_len = NS_tstrlen(destDir);
NS_tstrcat(backup_user_profile, userprofile + installdir_len);
- if (slash)
- *slash = NS_T('/');
LOG(("copy user profile back from " LOG_S " to " LOG_S, backup_user_profile, userprofile));
int rv2 = rename_file(backup_user_profile, userprofile);
if (rv2)
{
LOG(("failed to copy user profile back"));
}
+ if (slash)
+ *slash = NS_T('/');
}
#if !defined(_WIN32) && !defined(MACOSX)