diff options
Diffstat (limited to 'toolkit/xre')
-rw-r--r-- | toolkit/xre/nsAppRunner.cpp | 31 | ||||
-rw-r--r-- | toolkit/xre/nsUpdateDriver.cpp | 6 |
2 files changed, 33 insertions, 4 deletions
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 274631aac8..f9f007c6c8 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -2031,8 +2031,13 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n profile->GetRootDir(getter_AddRefs(prefsJSFile)); prefsJSFile->AppendNative(NS_LITERAL_CSTRING("prefs.js")); nsAutoCString pathStr; +#ifdef XP_WIN + prefsJSFile->GetPersistentDescriptor(pathStr); +#else prefsJSFile->GetNativePath(pathStr); +#endif PR_fprintf(PR_STDERR, "Success: created profile '%s' at '%s'\n", arg, pathStr.get()); + bool exists; prefsJSFile->Exists(&exists); if (!exists) { @@ -2271,11 +2276,15 @@ CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion, return false; nsCOMPtr<nsIFile> lf; - rv = NS_NewNativeLocalFile(buf, false, + rv = NS_NewNativeLocalFile(EmptyCString(), false, getter_AddRefs(lf)); if (NS_FAILED(rv)) return false; + rv = lf->SetPersistentDescriptor(buf); + if (NS_FAILED(rv)) + return false; + bool eq; rv = lf->Equals(aXULRunnerDir, &eq); if (NS_FAILED(rv) || !eq) @@ -2286,11 +2295,15 @@ CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion, if (NS_FAILED(rv)) return false; - rv = NS_NewNativeLocalFile(buf, false, + rv = NS_NewNativeLocalFile(EmptyCString(), false, getter_AddRefs(lf)); if (NS_FAILED(rv)) return false; + rv = lf->SetPersistentDescriptor(buf); + if (NS_FAILED(rv)) + return false; + rv = lf->Equals(aAppDir, &eq); if (NS_FAILED(rv) || !eq) return false; @@ -2330,11 +2343,11 @@ WriteVersion(nsIFile* aProfileDir, const nsCString& aVersion, file->AppendNative(FILE_COMPATIBILITY_INFO); nsAutoCString platformDir; - aXULRunnerDir->GetNativePath(platformDir); + Unused << aXULRunnerDir->GetPersistentDescriptor(platformDir); nsAutoCString appDir; if (aAppDir) - aAppDir->GetNativePath(appDir); + Unused << aAppDir->GetPersistentDescriptor(appDir); PRFileDesc *fd; nsresult rv = @@ -3673,6 +3686,16 @@ XREMain::XRE_mainRun() } } +#ifndef XP_WIN + nsCOMPtr<nsIFile> profileDir; + nsAutoCString path; + rv = mDirProvider.GetProfileStartupDir(getter_AddRefs(profileDir)); + if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(profileDir->GetNativePath(path)) && !IsUTF8(path)) { + PR_fprintf(PR_STDERR, "Error: The profile path is not valid UTF-8. Unable to continue.\n"); + return NS_ERROR_FAILURE; + } +#endif + mDirProvider.DoStartup(); // As FilePreferences need the profile directory, we must initialize right here. diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index 4994458852..c4c0a0f105 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -1075,7 +1075,13 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate) rv = ds->Get(XRE_EXECUTABLE_FILE, NS_GET_IID(nsIFile), getter_AddRefs(binary)); NS_ASSERTION(NS_SUCCEEDED(rv), "Can't get the binary path"); +#ifdef XP_WIN + nsAutoString binPathW; + binary->GetPath(binPathW); + NS_ConvertUTF16toUTF8 binPath(binPathW); +#else binary->GetNativePath(binPath); +#endif } // Copy the parameters to the StagedUpdateInfo structure shared with the |