~ruther/guix-local

ref: 4b9b2595e41d683be25dee85a0c1230ff62ec344 guix-local/gnu/packages/patches/icecat-use-system-wide-dir.patch -rw-r--r-- 1.4 KiB
4b9b2595 — jgart gnu: trealla: Update to 2.89.10. a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Upstream-status: https://bugzilla.mozilla.org/show_bug.cgi?id=1986219

diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
index 9c94cb8808aa..dfee051b302f 100644
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -276,11 +276,27 @@ nsresult nsXREDirProvider::GetBackgroundTasksProfilesRootDir(
  *
  * On OSX this is /Library/Application Support/Mozilla
  * On Linux this is /usr/{lib,lib64}/mozilla
- *   (for 32- and 64-bit systems respsectively)
+ *   (for 32- and 64-bit systems respectively)
+ *
+ * The MOZILLA_SYSTEM_DIR environment variable can be used to override
+ * the system directory used.
  */
 static nsresult GetSystemParentDirectory(nsIFile** aFile) {
-  nsresult rv;
+  nsresult rv = NS_ERROR_FAILURE;
   nsCOMPtr<nsIFile> localDir;
+
+  // Honor a the MOZILLA_SYSTEM_DIR environment variable first...
+  const char* systemParentDir = getenv("MOZILLA_SYSTEM_DIR");
+  if (systemParentDir) {
+    rv = NS_NewNativeLocalFile(nsDependentCString(systemParentDir),
+                               getter_AddRefs(localDir));
+  }
+  if (NS_SUCCEEDED(rv)) {
+    localDir.forget(aFile);
+    return rv;
+  }
+
+  // ... falling back to the conventional fixed location otherwise.
 #  if defined(XP_MACOSX)
   rv = GetOSXFolderType(kOnSystemDisk, kApplicationSupportFolderType,
                         getter_AddRefs(localDir));