diff --git a/mozilla/browser/components/dirprovider/nsBrowserDirectoryProvider.cpp b/mozilla/browser/components/dirprovider/nsBrowserDirectoryProvider.cpp index 060b944cf16..8fad543599d 100755 --- a/mozilla/browser/components/dirprovider/nsBrowserDirectoryProvider.cpp +++ b/mozilla/browser/components/dirprovider/nsBrowserDirectoryProvider.cpp @@ -42,7 +42,9 @@ #include "nsIPrefService.h" #include "nsIPrefBranch.h" +#include "nsBrowserDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h" +#include "nsDirectoryServiceDefs.h" #include "nsCategoryManagerUtils.h" #include "nsCOMArray.h" #include "nsIGenericFactory.h" @@ -98,6 +100,8 @@ nsBrowserDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist, { nsresult rv; + *aResult = nsnull; + // NOTE: This function can be reentrant through the NS_GetSpecialDirectory // call, so be careful not to cause infinite recursion. @@ -125,6 +129,24 @@ nsBrowserDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist, else if (!strcmp(aKey, NS_APP_SEARCH_50_FILE)) { leafName = "search.rdf"; } + else if (!strcmp(aKey, NS_APP_MICROSUMMARY_DIR)) { + rv = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR, + getter_AddRefs(file)); + NS_ENSURE_SUCCESS(rv, rv); + + file->AppendNative(NS_LITERAL_CSTRING("microsummary-generators")); + file.swap(*aResult); + return NS_OK; + } + else if (!strcmp(aKey, NS_APP_USER_MICROSUMMARY_DIR)) { + rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, + getter_AddRefs(file)); + NS_ENSURE_SUCCESS(rv, rv); + + file->AppendNative(NS_LITERAL_CSTRING("microsummary-generators")); + file.swap(*aResult); + return NS_OK; + } else { return NS_ERROR_FAILURE; } diff --git a/mozilla/browser/components/dirprovider/nsBrowserDirectoryServiceDefs.h b/mozilla/browser/components/dirprovider/nsBrowserDirectoryServiceDefs.h new file mode 100644 index 00000000000..d6999f7106c --- /dev/null +++ b/mozilla/browser/components/dirprovider/nsBrowserDirectoryServiceDefs.h @@ -0,0 +1,63 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Mozilla Firefox browser. + * + * The Initial Developer of the Original Code is Mozilla Corporation. + * + * Portions created by the Initial Developer are Copyright (C) 2006 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Myk Melez + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsBrowserDirectoryServiceDefs_h___ +#define nsBrowserDirectoryServiceDefs_h___ + +//============================================================================= +// +// Defines property names for directories available from the browser-specific +// nsBrowserDirectoryProvider. +// +// System and XPCOM properties are defined in nsDirectoryServiceDefs.h. +// General application properties are defined in nsAppDirectoryServiceDefs.h. +// +//============================================================================= + +// ---------------------------------------------------------------------------- +// Files and directories that exist on a per-browser basis. +// ---------------------------------------------------------------------------- + +#define NS_APP_MICROSUMMARY_DIR "MicsumGens" + +// ---------------------------------------------------------------------------- +// Files and directories that exist on a per-profile basis. +// ---------------------------------------------------------------------------- + +#define NS_APP_USER_MICROSUMMARY_DIR "UsrMicsumGens" + +#endif diff --git a/mozilla/browser/components/microsummaries/src/nsMicrosummaryService.js.in b/mozilla/browser/components/microsummaries/src/nsMicrosummaryService.js.in index 98364e12867..e2269c61cf5 100644 --- a/mozilla/browser/components/microsummaries/src/nsMicrosummaryService.js.in +++ b/mozilla/browser/components/microsummaries/src/nsMicrosummaryService.js.in @@ -439,8 +439,7 @@ MicrosummaryService.prototype = { var genName = doc.documentElement.getAttribute("name"); var fileName = sanitizeName(genName) + ".xml"; - var file = this._dirs.get("ProfD", Ci.nsIFile); - file.append("microsummary-generators"); + var file = this._dirs.get("UsrMicsumGens", Ci.nsIFile); file.append(fileName); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE); diff --git a/mozilla/xpcom/io/nsAppDirectoryServiceDefs.h b/mozilla/xpcom/io/nsAppDirectoryServiceDefs.h index 4d8dc32dbb9..c056083ded8 100755 --- a/mozilla/xpcom/io/nsAppDirectoryServiceDefs.h +++ b/mozilla/xpcom/io/nsAppDirectoryServiceDefs.h @@ -76,7 +76,6 @@ #define NS_APP_CHROME_DIR "AChrom" #define NS_APP_PLUGINS_DIR "APlugns" // Deprecated - use NS_APP_PLUGINS_DIR_LIST #define NS_APP_SEARCH_DIR "SrchPlugns" -#define NS_APP_MICROSUMMARY_DIR "MicsumGens" #define NS_APP_CHROME_DIR_LIST "AChromDL" #define NS_APP_PLUGINS_DIR_LIST "APluginsDL" @@ -103,7 +102,6 @@ #define NS_APP_USER_CHROME_DIR "UChrm" #define NS_APP_USER_SEARCH_DIR "UsrSrchPlugns" -#define NS_APP_USER_MICROSUMMARY_DIR "UsrMicsumGens" #define NS_APP_LOCALSTORE_50_FILE "LclSt" #define NS_APP_HISTORY_50_FILE "UHist" diff --git a/mozilla/xpcom/io/nsAppFileLocationProvider.cpp b/mozilla/xpcom/io/nsAppFileLocationProvider.cpp index 17aa5ec8837..a54d65d7a5b 100755 --- a/mozilla/xpcom/io/nsAppFileLocationProvider.cpp +++ b/mozilla/xpcom/io/nsAppFileLocationProvider.cpp @@ -109,7 +109,6 @@ #define CHROME_DIR_NAME NS_LITERAL_CSTRING("Chrome") #define PLUGINS_DIR_NAME NS_LITERAL_CSTRING("Plug-ins") #define SEARCH_DIR_NAME NS_LITERAL_CSTRING("Search Plugins") -#define MICROSUMMARY_DIR_NAME NS_LITERAL_CSTRING("Microsummary Generators") #else #define DEFAULTS_DIR_NAME NS_LITERAL_CSTRING("defaults") #define DEFAULTS_PREF_DIR_NAME NS_LITERAL_CSTRING("pref") @@ -118,7 +117,6 @@ #define CHROME_DIR_NAME NS_LITERAL_CSTRING("chrome") #define PLUGINS_DIR_NAME NS_LITERAL_CSTRING("plugins") #define SEARCH_DIR_NAME NS_LITERAL_CSTRING("searchplugins") -#define MICROSUMMARY_DIR_NAME NS_LITERAL_CSTRING("microsummary-generators") #endif //***************************************************************************** @@ -279,18 +277,6 @@ nsAppFileLocationProvider::GetFile(const char *prop, PRBool *persistant, nsIFile if (NS_SUCCEEDED(rv)) rv = (*_retval)->AppendNative(SEARCH_DIR_NAME); } - else if (nsCRT::strcmp(prop, NS_APP_MICROSUMMARY_DIR) == 0) - { - rv = CloneMozBinDirectory(getter_AddRefs(localFile)); - if (NS_SUCCEEDED(rv)) - rv = localFile->AppendRelativeNativePath(MICROSUMMARY_DIR_NAME); - } - else if (nsCRT::strcmp(prop, NS_APP_USER_MICROSUMMARY_DIR) == 0) - { - rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, _retval); - if (NS_SUCCEEDED(rv)) - rv = (*_retval)->AppendNative(MICROSUMMARY_DIR_NAME); - } else if (nsCRT::strcmp(prop, NS_APP_INSTALL_CLEANUP_DIR) == 0) { // This is cloned so that embeddors will have a hook to override