bug 411505 - fix more software update charset fallout. r=bsmedberg
--- 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;