File mozilla_dirs.patch of Package LibreWolf
diff --git a/toolkit/components/extensions/NativeManifests.sys.mjs b/toolkit/components/extensions/NativeManifests.sys.mjs
index 59313e821f..f3a7caa057 100644
--- a/toolkit/components/extensions/NativeManifests.sys.mjs
+++ b/toolkit/components/extensions/NativeManifests.sys.mjs
@@ -40,6 +40,8 @@
let dirs = [
Services.dirsvc.get("XREUserNativeManifests", Ci.nsIFile).path,
Services.dirsvc.get("XRESysNativeManifests", Ci.nsIFile).path,
+ Services.dirsvc.get("XREMozUserNativeManifests", Ci.nsIFile).path,
+ Services.dirsvc.get("XREMozSysNativeManifests", Ci.nsIFile).path,
];
this._lookup = (type, name, context) =>
this._tryPaths(type, name, dirs, context);
diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
index 9c94cb8808..af2dbdbf3f 100644
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -278,23 +278,25 @@
* On Linux this is /usr/{lib,lib64}/mozilla
* (for 32- and 64-bit systems respsectively)
*/
-static nsresult GetSystemParentDirectory(nsIFile** aFile) {
+static nsresult GetSystemParentDirectory(nsIFile** aFile,
+ nsCString aName = "LibreWolf"_ns) {
nsresult rv;
nsCOMPtr<nsIFile> localDir;
# if defined(XP_MACOSX)
rv = GetOSXFolderType(kOnSystemDisk, kApplicationSupportFolderType,
getter_AddRefs(localDir));
if (NS_SUCCEEDED(rv)) {
- rv = localDir->AppendNative("Mozilla"_ns);
+ rv = localDir->AppendNative(aName);
}
# else
- constexpr auto dirname =
+ ToLowerCase(aName);
+ nsCString dirname =
# ifdef HAVE_USR_LIB64_DIR
- "/usr/lib64/mozilla"_ns
+ "/usr/lib64/"_ns + aName
# elif defined(__OpenBSD__) || defined(__FreeBSD__)
- "/usr/local/lib/mozilla"_ns
+ "/usr/local/lib/"_ns + aName
# else
- "/usr/lib/mozilla"_ns
+ "/usr/lib/"_ns + aName
# endif
;
rv = NS_NewNativeLocalFile(dirname, getter_AddRefs(localDir));
@@ -362,10 +364,20 @@
#if defined(XP_UNIX) || defined(XP_MACOSX)
else if (!strcmp(aProperty, XRE_SYS_NATIVE_MANIFESTS)) {
rv = ::GetSystemParentDirectory(getter_AddRefs(file));
+ } else if (!strcmp(aProperty, XRE_MOZ_SYS_NATIVE_MANIFESTS)) {
+ rv = ::GetSystemParentDirectory(getter_AddRefs(file), "Mozilla"_ns);
} else if (!strcmp(aProperty, XRE_USER_NATIVE_MANIFESTS)) {
rv = GetUserDataDirectoryHome(getter_AddRefs(file), false);
NS_ENSURE_SUCCESS(rv, rv);
# if defined(XP_MACOSX)
+ rv = file->AppendNative("LibreWolf"_ns);
+# else // defined(XP_MACOSX)
+ rv = file->AppendNative(".librewolf"_ns);
+# endif // defined(XP_MACOSX)
+ } else if (!strcmp(aProperty, XRE_MOZ_USER_NATIVE_MANIFESTS)) {
+ rv = GetUserDataDirectoryHome(getter_AddRefs(file), false);
+ NS_ENSURE_SUCCESS(rv, rv);
+# if defined(XP_MACOSX)
rv = file->AppendNative("Mozilla"_ns);
# else // defined(XP_MACOSX)
rv = file->AppendNative(".mozilla"_ns);
@@ -398,9 +410,10 @@
else if (!strcmp(aProperty, XRE_SYS_SHARE_EXTENSION_PARENT_DIR)) {
# ifdef ENABLE_SYSTEM_EXTENSION_DIRS
# if defined(__OpenBSD__) || defined(__FreeBSD__)
- static const char* const sysLExtDir = "/usr/local/share/mozilla/extensions";
+ static const char* const sysLExtDir =
+ "/usr/local/share/librewolf/extensions";
# else
- static const char* const sysLExtDir = "/usr/share/mozilla/extensions";
+ static const char* const sysLExtDir = "/usr/share/librewolf/extensions";
# endif
rv = NS_NewNativeLocalFile(nsDependentCString(sysLExtDir),
getter_AddRefs(file));
@@ -926,13 +939,7 @@
}
appDirPath = Substring(appDirPath, 1, dotIndex - 1);
- bool hasVendor = GetAppVendor() && strlen(GetAppVendor()) != 0;
- if (hasVendor || GetAppName()) {
- if (NS_FAILED(localDir->AppendNative(
- nsDependentCString(hasVendor ? GetAppVendor() : GetAppName())))) {
- return NS_ERROR_FAILURE;
- }
- } else if (NS_FAILED(localDir->AppendNative("Mozilla"_ns))) {
+ if (NS_FAILED(localDir->AppendNative("LibreWolf"_ns))) {
return NS_ERROR_FAILURE;
}
@@ -1192,7 +1199,7 @@
#if defined(XP_MACOSX) || defined(XP_WIN)
- static const char* const sXR = "Mozilla";
+ static const char* const sXR = "LibreWolf";
rv = aFile->AppendNative(nsDependentCString(sXR));
NS_ENSURE_SUCCESS(rv, rv);
@@ -1202,7 +1209,7 @@
#elif defined(XP_UNIX)
- static const char* const sXR = ".mozilla";
+ static const char* const sXR = ".librewolf";
rv = aFile->AppendNative(nsDependentCString(sXR));
NS_ENSURE_SUCCESS(rv, rv);
@@ -1253,10 +1260,6 @@
if (!profile.IsEmpty()) {
rv = AppendProfileString(aFile, profile.get());
} else {
- if (!vendor.IsEmpty()) {
- rv = aFile->AppendNative(vendor);
- NS_ENSURE_SUCCESS(rv, rv);
- }
rv = aFile->AppendNative(appName);
}
NS_ENSURE_SUCCESS(rv, rv);
@@ -1288,16 +1291,6 @@
rv = AppendProfileString(aFile, folder.BeginReading());
} else {
- if (!vendor.IsEmpty()) {
- folder.Append(vendor);
- ToLowerCase(folder);
-
- rv = aFile->AppendNative(folder);
- NS_ENSURE_SUCCESS(rv, rv);
-
- folder.Truncate();
- }
-
// This can be the case in tests.
if (!appName.IsEmpty()) {
folder.Append(appName);
diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h
index 28a2a68c63..b0917fb9b8 100644
--- a/xpcom/build/nsXULAppAPI.h
+++ b/xpcom/build/nsXULAppAPI.h
@@ -116,6 +116,8 @@
*/
# define XRE_SYS_NATIVE_MANIFESTS "XRESysNativeManifests"
# define XRE_USER_NATIVE_MANIFESTS "XREUserNativeManifests"
+# define XRE_MOZ_SYS_NATIVE_MANIFESTS "XREMozSysNativeManifests"
+# define XRE_MOZ_USER_NATIVE_MANIFESTS "XREMozUserNativeManifests"
#endif
/**