Files
lbmk/config/firefox/default/patches/0027-profile-directory.patch.patch
T
Leah Rowe 2b34aeea5d WIP: convert to lwmk
Signed-off-by: Leah Rowe <leah@libreboot.org>
2026-09-08 06:44:40 +01:00

72 lines
2.3 KiB
Diff

From 2d9a9c339498838aa373ea09383861eb7a84851a Mon Sep 17 00:00:00 2001
From: LibreWolf Developers <noreply@librewolf.net>
Date: Sun, 6 Sep 2026 10:10:56 +0100
Subject: [PATCH 27/52] profile-directory.patch
---
extensions/pref/autoconfig/src/prefcalls.js | 48 +++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/extensions/pref/autoconfig/src/prefcalls.js b/extensions/pref/autoconfig/src/prefcalls.js
index 78dd0ee5473a..4231262f29b8 100644
--- a/extensions/pref/autoconfig/src/prefcalls.js
+++ b/extensions/pref/autoconfig/src/prefcalls.js
@@ -9,6 +9,54 @@ const LDAPSyncQueryContractID = "@mozilla.org/ldapsyncquery;1";
var gIsUTF8;
+{
+ let profile_directory = null;
+ let defaults = Services.prefs.getDefaultBranch(null);
+
+ let supportsXDG = Services.prefs.getBoolPref("widget.support-xdg-config", false);
+
+ if (supportsXDG) {
+ let isLegacy = false;
+ {
+ let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties || Ci.nsIDirectoryService);
+ let profDir = dirSvc.get("ProfD", Ci.nsIFile);
+ let path = profDir.path || "";
+ isLegacy = path.includes(".librewolf");
+ }
+
+ if (!isLegacy) {
+ let xdg = Services.env.get("XDG_CONFIG_HOME");
+ if (xdg) {
+ profile_directory = xdg;
+ } else {
+ let home = Services.env.get("HOME");
+ profile_directory = home ? (home + "/.config") : null;
+ }
+ if (profile_directory) {
+ defaults.setCharPref(
+ "autoadmin.global_config_url",
+ `file://${profile_directory}/librewolf/librewolf/librewolf.overrides.cfg`
+ );
+ }
+ } else {
+ if (profile_directory = Services.env.get("HOME")) {
+ defaults.setCharPref(
+ "autoadmin.global_config_url",
+ `file://${profile_directory}/.librewolf/librewolf.overrides.cfg`
+ );
+ }
+ }
+ } else {
+ if ((profile_directory = Services.env.get("USERPROFILE") || Services.env.get("HOME"))) {
+ defaults.setCharPref(
+ "autoadmin.global_config_url",
+ `file://${profile_directory}/.librewolf/librewolf.overrides.cfg`
+ );
+ }
+ }
+}
+
function getPrefBranch() {
return Services.prefs.getBranch(null);
}
--
2.47.3