summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2022-02-01 17:39:30 +0000
committerMoonchild <moonchild@palemoon.org>2022-02-01 17:39:30 +0000
commit7a400c29366038f1f2ac28741e9c9bd8fd8fa062 (patch)
treee4a66af85c41c3136332f107ebdbf18d5ced59bc /system
parentdcccadd1c5825afb370d739f6536b8bfb2b21d4a (diff)
downloadaura-central-7a400c29366038f1f2ac28741e9c9bd8fd8fa062.tar.gz
Issue %3057 - Part 4: Stop using GetNativePath in nsAppRunner on Windows.
Diffstat (limited to 'system')
-rw-r--r--system/runtime/nsAppRunner.cpp31
1 files changed, 27 insertions, 4 deletions
diff --git a/system/runtime/nsAppRunner.cpp b/system/runtime/nsAppRunner.cpp
index 6cb7e3174..7159c655a 100644
--- a/system/runtime/nsAppRunner.cpp
+++ b/system/runtime/nsAppRunner.cpp
@@ -1985,8 +1985,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) {
@@ -2225,11 +2230,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)
@@ -2240,11 +2249,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;
@@ -2284,11 +2297,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 =
@@ -3568,6 +3581,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.