bug 411505 - fix more software update charset fallout. r=bsmedberg
authorted.mielczarek@gmail.com
Mon, 21 Jan 2008 17:20:19 -0800
changeset 10508 1fa05442cbd2e0b3e5b61d38c3acc333a3c66480
parent 10507 970efe18f8a67cc20b907f29bdc281c289637dbe
child 10509 d71ab8202cbefba6588f957e6a233d2f0372f782
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs411505
milestone1.9b3pre
bug 411505 - fix more software update charset fallout. r=bsmedberg
toolkit/xre/nsUpdateDriver.cpp
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -114,16 +114,23 @@ static nsresult
 GetCurrentWorkingDir(char *buf, size_t size)
 {
   // Cannot use NS_GetSpecialDirectory because XPCOM is not yet initialized.
   // This code is duplicated from xpcom/io/SpecialSystemDirectory.cpp:
 
 #if defined(XP_OS2)
   if (DosQueryPathInfo( ".", FIL_QUERYFULLNAME, buf, size))
     return NS_ERROR_FAILURE;
+#elif defined(XP_WIN)
+  wchar_t *wpath = _wgetcwd(NULL, size);
+  if (!wpath)
+    return NS_ERROR_FAILURE;
+  NS_ConvertUTF16toUTF8 path(wpath);
+  strncpy(buf, path.get(), size);
+  free(wpath);
 #else
   if(!getcwd(buf, size))
     return NS_ERROR_FAILURE;
 #endif
   return NS_OK;
 }
 
 #if defined(XP_MACOSX)
@@ -403,18 +410,26 @@ ApplyUpdate(nsIFile *greDir, nsIFile *up
   rv = appDir->GetPath(applyToDir);
 #else
   nsCAutoString applyToDir;
   rv = appDir->GetNativePath(applyToDir);
 #endif
   if (NS_FAILED(rv))
     return;
 
+#if defined(XP_WIN)
+  nsAutoString updateDirPathW;
+  rv = updateDir->GetPath(updateDirPathW);
+
+  NS_ConvertUTF16toUTF8 updateDirPath(updateDirPathW);
+#else
   nsCAutoString updateDirPath;
   rv = updateDir->GetNativePath(updateDirPath);
+#endif
+
   if (NS_FAILED(rv))
     return;
 
   // Get the current working directory.
   char workingDirPath[MAXPATHLEN];
   rv = GetCurrentWorkingDir(workingDirPath, sizeof(workingDirPath));
   if (NS_FAILED(rv))
     return;