From b69ccc0a17a8eeb91821c72d7285f8d556f90fc7 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sat, 11 May 2013 20:14:58 +0200 Subject: [PATCH] Bug 842334 - Move distribution/ back to the installation directory. r=bsmedberg,r=gavin --- browser/components/dirprovider/DirectoryProvider.cpp | 4 ++-- browser/components/distribution.js | 4 ++-- .../places/tests/unit/test_browserGlue_distribution.js | 8 ++++---- toolkit/xre/nsXREDirProvider.cpp | 10 ++++++---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/browser/components/dirprovider/DirectoryProvider.cpp b/browser/components/dirprovider/DirectoryProvider.cpp index 92bc762d7418..e3f2882e1a35 100644 --- a/browser/components/dirprovider/DirectoryProvider.cpp +++ b/browser/components/dirprovider/DirectoryProvider.cpp @@ -125,12 +125,12 @@ static void AppendDistroSearchDirs(nsIProperties* aDirSvc, nsCOMArray &array) { nsCOMPtr searchPlugins; - nsresult rv = aDirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR, + nsresult rv = aDirSvc->Get(XRE_EXECUTABLE_FILE, NS_GET_IID(nsIFile), getter_AddRefs(searchPlugins)); if (NS_FAILED(rv)) return; - searchPlugins->AppendNative(NS_LITERAL_CSTRING("distribution")); + searchPlugins->SetNativeLeafName(NS_LITERAL_CSTRING("distribution")); searchPlugins->AppendNative(NS_LITERAL_CSTRING("searchplugins")); bool exists; diff --git a/browser/components/distribution.js b/browser/components/distribution.js index 03a36e7b8a6e..6bd820d0fbb8 100644 --- a/browser/components/distribution.js +++ b/browser/components/distribution.js @@ -19,8 +19,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", this.DistributionCustomizer = function DistributionCustomizer() { let dirSvc = Cc["@mozilla.org/file/directory_service;1"]. getService(Ci.nsIProperties); - let iniFile = dirSvc.get("XCurProcD", Ci.nsIFile); - iniFile.append("distribution"); + let iniFile = dirSvc.get("XREExeF", Ci.nsIFile); + iniFile.leafName = "distribution"; iniFile.append("distribution.ini"); if (iniFile.exists()) this._iniFile = iniFile; diff --git a/browser/components/places/tests/unit/test_browserGlue_distribution.js b/browser/components/places/tests/unit/test_browserGlue_distribution.js index 87a73725d649..49839ef7a5da 100644 --- a/browser/components/places/tests/unit/test_browserGlue_distribution.js +++ b/browser/components/places/tests/unit/test_browserGlue_distribution.js @@ -18,8 +18,8 @@ function run_test() do_test_pending(); // Copy distribution.ini file to our app dir. - let distroDir = Services.dirsvc.get("XCurProcD", Ci.nsIFile); - distroDir.append("distribution"); + let distroDir = Services.dirsvc.get("XREExeF", Ci.nsIFile); + distroDir.leafName = "distribution"; let iniFile = distroDir.clone(); iniFile.append("distribution.ini"); if (iniFile.exists()) { @@ -94,8 +94,8 @@ function onCustomizationComplete() do_register_cleanup(function() { // Remove the distribution file, even if the test failed, otherwise all // next tests will import it. - let iniFile = Services.dirsvc.get("XCurProcD", Ci.nsIFile); - iniFile.append("distribution"); + let iniFile = Services.dirsvc.get("XREExeF", Ci.nsIFile); + iniFile.leafName = "distribution"; iniFile.append("distribution.ini"); if (iniFile.exists()) iniFile.remove(false); diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index bd0d50f848c1..5ed667ba55be 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -373,9 +373,10 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, #endif } else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_DIR)) { - rv = GetAppDir()->Clone(getter_AddRefs(file)); + bool persistent = false; + rv = GetFile(XRE_EXECUTABLE_FILE, &persistent, getter_AddRefs(file)); if (NS_SUCCEEDED(rv)) - rv = file->AppendNative(NS_LITERAL_CSTRING("distribution")); + rv = file->SetNativeLeafName(NS_LITERAL_CSTRING("distribution")); } else if (NS_SUCCEEDED(GetProfileStartupDir(getter_AddRefs(file)))) { // We need to allow component, xpt, and chrome registration to @@ -611,11 +612,12 @@ void nsXREDirProvider::LoadAppBundleDirs() { nsCOMPtr dir; - nsresult rv = mXULAppDir->Clone(getter_AddRefs(dir)); + bool persistent = false; + nsresult rv = GetFile(XRE_EXECUTABLE_FILE, &persistent, getter_AddRefs(dir)); if (NS_FAILED(rv)) return; - dir->AppendNative(NS_LITERAL_CSTRING("distribution")); + dir->SetNativeLeafName(NS_LITERAL_CSTRING("distribution")); dir->AppendNative(NS_LITERAL_CSTRING("bundles")); nsCOMPtr e;