diff --git a/mozilla/Makefile.in b/mozilla/Makefile.in index dd59c64613d..bbe0a7cae9a 100644 --- a/mozilla/Makefile.in +++ b/mozilla/Makefile.in @@ -87,7 +87,6 @@ DIRS += \ include \ modules/libutil \ netwerk \ - modules/appfilelocprovider \ modules/mpfilelocprovider \ uriloader \ intl \ diff --git a/mozilla/allmakefiles.sh b/mozilla/allmakefiles.sh index cefeae6ed79..a6ac885a208 100755 --- a/mozilla/allmakefiles.sh +++ b/mozilla/allmakefiles.sh @@ -278,12 +278,6 @@ layout/xsl/document/Makefile layout/xsl/document/src/Makefile " -MAKEFILES_appfilelocprovider=" -modules/appfilelocprovider/Makefile -modules/appfilelocprovider/public/Makefile -modules/appfilelocprovider/src/Makefile -" - MAKEFILES_mpfilelocprovider=" modules/mpfilelocprovider/Makefile modules/mpfilelocprovider/public/Makefile @@ -737,7 +731,6 @@ modules/libpref/public/Makefile profile/public/Makefile caps/idl/Makefile caps/include/Makefile -modules/appfilelocprovider/public/Makefile netwerk/protocol/http/public/Makefile widget/public/Makefile rdf/base/idl/Makefile @@ -982,7 +975,6 @@ $MAKEFILES_libimg $MAKEFILES_libjar $MAKEFILES_libpref $MAKEFILES_libutil -$MAKEFILES_appfilelocprovider $MAKEFILES_mpfilelocprovider $MAKEFILES_liveconnect $MAKEFILES_mailnews diff --git a/mozilla/build/mac/build_scripts/MozillaBuildList.pm b/mozilla/build/mac/build_scripts/MozillaBuildList.pm index 2fbe31b922a..cab86407fda 100644 --- a/mozilla/build/mac/build_scripts/MozillaBuildList.pm +++ b/mozilla/build/mac/build_scripts/MozillaBuildList.pm @@ -502,9 +502,6 @@ sub BuildClientDist() #LIBUTIL InstallFromManifest(":mozilla:modules:libutil:public:MANIFEST", "$distdirectory:libutil:"); - # APPFILELOCPROVIDER - InstallFromManifest(":mozilla:modules:appfilelocprovider:public:MANIFEST", "$distdirectory:appfilelocprovider:"); - # MPFILELOCPROVIDER InstallFromManifest(":mozilla:modules:mpfilelocprovider:public:MANIFEST", "$distdirectory:mpfilelocprovider:"); @@ -1128,8 +1125,6 @@ sub BuildCommonProjects() #// Static libraries # Static Libs - BuildOneProject(":mozilla:modules:appfilelocprovider:macbuild:appfilelocprovider.mcp", "appfilelocprovider$D.o", 0, 0, 0); - MakeAlias(":mozilla:modules:appfilelocprovider:macbuild:appfilelocprovider$D.o", ":mozilla:dist:appfilelocprovider:"); BuildOneProject(":mozilla:modules:mpfilelocprovider:macbuild:mpfilelocprovider.mcp", "mpfilelocprovider$D.o", 0, 0, 0); MakeAlias(":mozilla:modules:mpfilelocprovider:macbuild:mpfilelocprovider$D.o", ":mozilla:dist:mpfilelocprovider:"); diff --git a/mozilla/build/unix/modules.mk b/mozilla/build/unix/modules.mk index ff5738c26bb..eab63a6586e 100644 --- a/mozilla/build/unix/modules.mk +++ b/mozilla/build/unix/modules.mk @@ -87,9 +87,9 @@ BM_CVS_transformiix = extensions/transformiix # psm # BM_DIRS_psm = $(BM_DIRS_dbm) $(BM_DIRS_xpcom) security netwerk/base/public netwerk/socket/base dom/public $(BM_DIRS_js) extensions/psm-glue -BM_DEP_DIRS_psm = $(BM_DEP_DIRS_dbm) $(BM_DEP_DIRS_xpcom) $(BM_DEP_DIRS_js) intl/locale/idl intl/locale/public intl/strres/public uriloader/base modules/libpref/public profile/public caps/idl modules/appfilelocprovider/public netwerk/protocol/http/public gfx/idl gfx/public rdf/base/idl xpfe/appshell/public widget/public docshell/base layout/html/forms/public layout/base/public rdf/content/public dom/src/base modules/oji/public caps/include +BM_DEP_DIRS_psm = $(BM_DEP_DIRS_dbm) $(BM_DEP_DIRS_xpcom) $(BM_DEP_DIRS_js) intl/locale/idl intl/locale/public intl/strres/public uriloader/base modules/libpref/public profile/public caps/idl netwerk/protocol/http/public gfx/idl gfx/public rdf/base/idl xpfe/appshell/public widget/public docshell/base layout/html/forms/public layout/base/public rdf/content/public dom/src/base modules/oji/public caps/include BM_CVS_psm = $(BM_CVS_dbm) $(BM_CVS_xpcom) $(BM_CVS_js) security netwerk/base/public netwerk/socket/base dom/public $(BM_CVS_js) extensions/psm-glue -BM_CVS_NS_psm = $(BM_CVS_NS_dbm) $(BM_CVS_NS_xpcom) $(BM_CVS_NS_js) intl/locale/idl intl/locale/public intl/strres/public uriloader/base modules/libpref/public profile/public caps/idl modules/appfilelocprovider/public netwerk/protocol/http/public gfx/idl gfx/public rdf/base/idl xpfe/appshell/public widget/public docshell/base layout/html/forms/public layout/base/public rdf/content/public dom/src/base modules/oji/public caps/include +BM_CVS_NS_psm = $(BM_CVS_NS_dbm) $(BM_CVS_NS_xpcom) $(BM_CVS_NS_js) intl/locale/idl intl/locale/public intl/strres/public uriloader/base modules/libpref/public profile/public caps/idl netwerk/protocol/http/public gfx/idl gfx/public rdf/base/idl xpfe/appshell/public widget/public docshell/base layout/html/forms/public layout/base/public rdf/content/public dom/src/base modules/oji/public caps/include # diff --git a/mozilla/chrome/tools/chromereg/regchrome.cpp b/mozilla/chrome/tools/chromereg/regchrome.cpp index 8439c81fd8c..8fce9874c0e 100644 --- a/mozilla/chrome/tools/chromereg/regchrome.cpp +++ b/mozilla/chrome/tools/chromereg/regchrome.cpp @@ -22,7 +22,6 @@ #include "nsIServiceManager.h" #include "nsCOMPtr.h" #include "nsIChromeRegistry.h" -#include "nsAppFileLocationProvider.h" int main(int argc, char **argv) { @@ -34,32 +33,7 @@ int main(int argc, char **argv) NS_WARNING("chrome check couldn't get the chrome registry"); return NS_ERROR_FAILURE; } - // initialize the directory service so that the chrome directory can - // be found when registering new chrome. - nsIDirectoryServiceProvider *appFileLocProvider; - appFileLocProvider = new nsAppFileLocationProvider; - if (!appFileLocProvider) { - NS_WARNING("failed to create directory service provider\n"); - return NS_ERROR_FAILURE; - } - // add a reference - NS_ADDREF(appFileLocProvider); - nsresult rv; - NS_WITH_SERVICE(nsIDirectoryService, directoryService, - NS_DIRECTORY_SERVICE_CONTRACTID, &rv); - if (NS_FAILED(rv)) { - NS_WARNING("failed to get directory service"); - return rv; - } - rv = directoryService->RegisterProvider(appFileLocProvider); - if (NS_FAILED(rv)) { - NS_WARNING("failed to register provider"); - return rv; - } - NS_RELEASE(appFileLocProvider); // RegisterProvider did AddRef - It owns it now chromeReg->CheckForNewChrome(); - // release the directory service before we shutdown XPCOM - directoryService = 0; // release the chrome registry before we shutdown XPCOM chromeReg = 0; NS_ShutdownXPCOM(nsnull); diff --git a/mozilla/embedding/base/nsEmbedAPI.cpp b/mozilla/embedding/base/nsEmbedAPI.cpp index 7ac4a85903b..a93ec5d6681 100644 --- a/mozilla/embedding/base/nsEmbedAPI.cpp +++ b/mozilla/embedding/base/nsEmbedAPI.cpp @@ -29,7 +29,6 @@ #include "nsIStringBundle.h" #include "nsIDirectoryService.h" -#include "nsAppFileLocationProvider.h" #include "nsEmbedAPI.h" @@ -86,26 +85,10 @@ nsresult NS_InitEmbedding(nsILocalFile *mozBinDirectory, #endif { // Initialise XPCOM - NS_InitXPCOM(&sServiceManager, mozBinDirectory); + NS_InitXPCOM2(&sServiceManager, mozBinDirectory, appFileLocProvider); if (!sServiceManager) return NS_ERROR_NULL_POINTER; - - // Hook up the file location provider - make one if nsnull was passed - if (!appFileLocProvider) - { - appFileLocProvider = new nsAppFileLocationProvider; - if (!appFileLocProvider) - return NS_ERROR_OUT_OF_MEMORY; - NS_ADDREF(appFileLocProvider); - } - NS_WITH_SERVICE(nsIDirectoryService, directoryService, NS_DIRECTORY_SERVICE_CONTRACTID, &rv); - if (NS_FAILED(rv)) - return rv; - rv = directoryService->RegisterProvider(appFileLocProvider); - if (NS_FAILED(rv)) - return rv; - NS_RELEASE(appFileLocProvider); // RegisterProvider did AddRef - It owns it now - + #ifdef HACK_AROUND_NONREENTRANT_INITXPCOM sXPCOMInitializedFlag = PR_TRUE; sXPCOMCleanupHack.mCleanOnExit = PR_TRUE; diff --git a/mozilla/embedding/browser/activex/src/control/makefile.win b/mozilla/embedding/browser/activex/src/control/makefile.win index 54809475d04..5557278b2ff 100644 --- a/mozilla/embedding/browser/activex/src/control/makefile.win +++ b/mozilla/embedding/browser/activex/src/control/makefile.win @@ -85,7 +85,6 @@ OBJS = \ LLIBS= \ $(DIST)\lib\xpcom.lib \ $(DIST)\lib\baseembed_s.lib \ - $(DIST)\lib\appfilelocprovider_s.lib \ $(LIBNSPR) \ $(NULL) diff --git a/mozilla/embedding/browser/gtk/src/Makefile.in b/mozilla/embedding/browser/gtk/src/Makefile.in index 9dd127ec57f..fe648066870 100644 --- a/mozilla/embedding/browser/gtk/src/Makefile.in +++ b/mozilla/embedding/browser/gtk/src/Makefile.in @@ -35,7 +35,6 @@ CPPSRCS = \ SHARED_LIBRARY_LIBS= \ $(DIST)/lib/libembed_base_s.$(LIB_SUFFIX) \ - $(DIST)/lib/libxpfelocation_s.$(LIB_SUFFIX) \ $(DIST)/lib/libmpfilelocprovider_s.$(LIB_SUFFIX) \ $(NULL) diff --git a/mozilla/embedding/browser/photon/src/Makefile.in b/mozilla/embedding/browser/photon/src/Makefile.in index c1f15ee2fd7..2e72c440c3e 100644 --- a/mozilla/embedding/browser/photon/src/Makefile.in +++ b/mozilla/embedding/browser/photon/src/Makefile.in @@ -36,7 +36,6 @@ CPPSRCS = \ SHARED_LIBRARY_LIBS= \ $(DIST)/lib/libembed_base_s.$(LIB_SUFFIX) \ - $(DIST)/lib/libxpfelocation_s.$(LIB_SUFFIX) \ $(NULL) EXPORTS = \ diff --git a/mozilla/embedding/browser/powerplant/PPBrowser.mcp b/mozilla/embedding/browser/powerplant/PPBrowser.mcp index f2a62fd25fd..14701763d10 100755 Binary files a/mozilla/embedding/browser/powerplant/PPBrowser.mcp and b/mozilla/embedding/browser/powerplant/PPBrowser.mcp differ diff --git a/mozilla/embedding/browser/powerplant/source/CBrowserApp.cp b/mozilla/embedding/browser/powerplant/source/CBrowserApp.cp index c6fa12567a9..db36df5d74c 100644 --- a/mozilla/embedding/browser/powerplant/source/CBrowserApp.cp +++ b/mozilla/embedding/browser/powerplant/source/CBrowserApp.cp @@ -46,6 +46,8 @@ #include "CThrobber.h" #include "CWebBrowserCMAttachment.h" #include "UMacUnicode.h" +#include "CAppFileLocationProvider.h" + #include "nsIImageManager.h" #include "nsIServiceManager.h" #include "nsIEventQueueService.h" @@ -168,8 +170,11 @@ CBrowserApp::CBrowserApp() appDir = do_QueryInterface(macDir); } } + + CAppFileLocationProvider *fileLocProvider = new CAppFileLocationProvider(kProgramName); + ThrowIfNil_(fileLocProvider); - rv = NS_InitEmbedding(appDir, nsnull); + rv = NS_InitEmbedding(appDir, fileLocProvider); } @@ -208,9 +213,9 @@ CBrowserApp::StartUp() nsCOMPtr rootDir; nsMPFileLocProvider *locationProvider = new nsMPFileLocProvider; ThrowIfNil_(locationProvider); - rv = NS_GetSpecialDirectory(NS_MAC_PREFS_DIR, getter_AddRefs(rootDir)); + rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILES_ROOT_DIR, getter_AddRefs(rootDir)); ThrowIfNil_(rootDir); - rv = locationProvider->Initialize(rootDir, kProgramName); + rv = locationProvider->Initialize(rootDir, "guest"); ThrowIfError_(rv); NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv); diff --git a/mozilla/embedding/browser/powerplant/source/CBrowserShell.cpp b/mozilla/embedding/browser/powerplant/source/CBrowserShell.cpp index 7ffba380637..cc98f234d6e 100644 --- a/mozilla/embedding/browser/powerplant/source/CBrowserShell.cpp +++ b/mozilla/embedding/browser/powerplant/source/CBrowserShell.cpp @@ -823,9 +823,7 @@ nsresult CBrowserShell::GetClipboardHandler(nsIClipboardCommands **aCommand) { NS_ENSURE_ARG_POINTER(aCommand); - nsCOMPtr docShell(do_GetInterface(mWebBrowser)); - NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE); - nsCOMPtr clipCmd(do_QueryInterface(docShell)); + nsCOMPtr clipCmd(do_GetInterface(mWebBrowser)); NS_ENSURE_TRUE(clipCmd, NS_ERROR_FAILURE); *aCommand = clipCmd; diff --git a/mozilla/embedding/tests/gtkEmbed/Makefile.in b/mozilla/embedding/tests/gtkEmbed/Makefile.in index 302381eae15..dedef466604 100644 --- a/mozilla/embedding/tests/gtkEmbed/Makefile.in +++ b/mozilla/embedding/tests/gtkEmbed/Makefile.in @@ -34,7 +34,6 @@ PROGRAM = gtkEmbed LIBS= \ $(DIST)/lib/libembed_base_s.$(LIB_SUFFIX) \ - $(DIST)/lib/libxpfelocation_s.$(LIB_SUFFIX) \ $(MOZ_COMPONENT_LIBS) \ -lgtksuperwin \ $(PROFILE_LIBS) \ diff --git a/mozilla/embedding/tests/winEmbed/makefile.win b/mozilla/embedding/tests/winEmbed/makefile.win index bfd95f68d42..7bc1b75972f 100644 --- a/mozilla/embedding/tests/winEmbed/makefile.win +++ b/mozilla/embedding/tests/winEmbed/makefile.win @@ -35,7 +35,6 @@ OBJS = \ LLIBS= \ $(DIST)\lib\baseembed_s.lib \ - $(DIST)\lib\appfilelocprovider_s.lib \ $(DIST)\lib\gkgfxwin.lib \ $(DIST)\lib\xpcom.lib \ $(LIBNSPR) \ diff --git a/mozilla/makefile.win b/mozilla/makefile.win index ad837893f28..886bdb6986a 100644 --- a/mozilla/makefile.win +++ b/mozilla/makefile.win @@ -54,7 +54,6 @@ DIRS = \ db \ dbm \ modules\libutil \ - modules\appfilelocprovider \ modules\mpfilelocprovider \ modules\zlib \ netwerk \ diff --git a/mozilla/modules/libreg/xpcom/nsRegistry.cpp b/mozilla/modules/libreg/xpcom/nsRegistry.cpp index a510429259e..3a044addfda 100644 --- a/mozilla/modules/libreg/xpcom/nsRegistry.cpp +++ b/mozilla/modules/libreg/xpcom/nsRegistry.cpp @@ -24,6 +24,7 @@ #include "nsIEnumerator.h" #include "nsDirectoryService.h" #include "nsDirectoryServiceDefs.h" +#include "nsAppDirectoryServiceDefs.h" #include "NSReg.h" #include "prmem.h" #include "prlock.h" @@ -537,7 +538,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) NS_GET_IID(nsIProperties), getter_AddRefs(directoryService)); if (NS_FAILED(rv)) return rv; - directoryService->Get(NS_XPCOM_APPLICATION_REGISTRY_FILE, NS_GET_IID(nsIFile), + directoryService->Get(NS_APP_APPLICATION_REGISTRY_FILE, NS_GET_IID(nsIFile), getter_AddRefs(registryLocation)); if (registryLocation) diff --git a/mozilla/profile/src/nsProfileAccess.cpp b/mozilla/profile/src/nsProfileAccess.cpp index fc5fbce320f..3cd8f852430 100644 --- a/mozilla/profile/src/nsProfileAccess.cpp +++ b/mozilla/profile/src/nsProfileAccess.cpp @@ -35,6 +35,7 @@ #include "nsFileStream.h" #include "nsEscape.h" #include "nsDirectoryServiceDefs.h" +#include "nsAppDirectoryServiceDefs.h" #include "nsILocalFile.h" #include "nsReadableUtils.h" @@ -109,7 +110,7 @@ nsProfileAccess::nsProfileAccess() m4xProfiles = new nsVoidArray(); // Get the profile registry path - NS_GetSpecialDirectory(NS_XPCOM_APPLICATION_REGISTRY_FILE, getter_AddRefs(mNewRegFile)); + NS_GetSpecialDirectory(NS_APP_APPLICATION_REGISTRY_FILE, getter_AddRefs(mNewRegFile)); PRBool regDataMoved = PR_FALSE; PRBool oldMozRegFileExists = PR_FALSE; diff --git a/mozilla/rdf/chrome/tools/chromereg/Makefile.in b/mozilla/rdf/chrome/tools/chromereg/Makefile.in index 3213c433299..824b3e5ba14 100644 --- a/mozilla/rdf/chrome/tools/chromereg/Makefile.in +++ b/mozilla/rdf/chrome/tools/chromereg/Makefile.in @@ -33,7 +33,6 @@ CPPSRCS = regchrome.cpp SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX)) LIBS = \ - $(DIST)/lib/libxpfelocation_s.$(LIB_SUFFIX) \ $(MOZ_COMPONENT_LIBS) \ $(NULL) diff --git a/mozilla/rdf/chrome/tools/chromereg/makefile.win b/mozilla/rdf/chrome/tools/chromereg/makefile.win index 71b1a0f76fb..86e73cd979f 100644 --- a/mozilla/rdf/chrome/tools/chromereg/makefile.win +++ b/mozilla/rdf/chrome/tools/chromereg/makefile.win @@ -21,7 +21,6 @@ PROG = .\$(OBJDIR)\regchrome.exe PROGRAMS = $(PROG) LINCS= \ - $(DIST)\lib\appfilelocprovider_s.$(LIB_SUFFIX) \ -Iservices \ -I$(PUBLIC)\xpcom diff --git a/mozilla/rdf/chrome/tools/chromereg/regchrome.cpp b/mozilla/rdf/chrome/tools/chromereg/regchrome.cpp index 8439c81fd8c..8fce9874c0e 100644 --- a/mozilla/rdf/chrome/tools/chromereg/regchrome.cpp +++ b/mozilla/rdf/chrome/tools/chromereg/regchrome.cpp @@ -22,7 +22,6 @@ #include "nsIServiceManager.h" #include "nsCOMPtr.h" #include "nsIChromeRegistry.h" -#include "nsAppFileLocationProvider.h" int main(int argc, char **argv) { @@ -34,32 +33,7 @@ int main(int argc, char **argv) NS_WARNING("chrome check couldn't get the chrome registry"); return NS_ERROR_FAILURE; } - // initialize the directory service so that the chrome directory can - // be found when registering new chrome. - nsIDirectoryServiceProvider *appFileLocProvider; - appFileLocProvider = new nsAppFileLocationProvider; - if (!appFileLocProvider) { - NS_WARNING("failed to create directory service provider\n"); - return NS_ERROR_FAILURE; - } - // add a reference - NS_ADDREF(appFileLocProvider); - nsresult rv; - NS_WITH_SERVICE(nsIDirectoryService, directoryService, - NS_DIRECTORY_SERVICE_CONTRACTID, &rv); - if (NS_FAILED(rv)) { - NS_WARNING("failed to get directory service"); - return rv; - } - rv = directoryService->RegisterProvider(appFileLocProvider); - if (NS_FAILED(rv)) { - NS_WARNING("failed to register provider"); - return rv; - } - NS_RELEASE(appFileLocProvider); // RegisterProvider did AddRef - It owns it now chromeReg->CheckForNewChrome(); - // release the directory service before we shutdown XPCOM - directoryService = 0; // release the chrome registry before we shutdown XPCOM chromeReg = 0; NS_ShutdownXPCOM(nsnull); diff --git a/mozilla/webshell/tests/viewer/Makefile.in b/mozilla/webshell/tests/viewer/Makefile.in index c65e9eded7b..6095fb600ad 100644 --- a/mozilla/webshell/tests/viewer/Makefile.in +++ b/mozilla/webshell/tests/viewer/Makefile.in @@ -122,12 +122,6 @@ ifdef MOZ_FULLCIRCLE XP_LIBS += $(FULLCIRCLE_LIBS) endif -ifeq ($(MOZ_WIDGET_TOOLKIT),os2) -XP_LIBS += -llibxpfelocation_s -else -XP_LIBS += -lxpfelocation_s -endif - XP_LIBS += \ $(XP_NS_UNDERBAR_CRAP) \ $(XP_DIST_LIBS) \ diff --git a/mozilla/webshell/tests/viewer/mac/viewer.mcp b/mozilla/webshell/tests/viewer/mac/viewer.mcp index 827e9a9e627..cf3a6d25621 100644 Binary files a/mozilla/webshell/tests/viewer/mac/viewer.mcp and b/mozilla/webshell/tests/viewer/mac/viewer.mcp differ diff --git a/mozilla/webshell/tests/viewer/makefile.win b/mozilla/webshell/tests/viewer/makefile.win index 423dcf0ca51..526faceab45 100644 --- a/mozilla/webshell/tests/viewer/makefile.win +++ b/mozilla/webshell/tests/viewer/makefile.win @@ -97,7 +97,6 @@ LLIBS= \ $(DIST)\lib\raptornativewidgets_s.lib \ $(DIST)\lib\raptorbasewidget_s.lib \ $(DIST)\lib\raptorwidget_s.lib \ - $(DIST)\lib\appfilelocprovider_s.lib \ # $(DIST)\lib\widgetsupport_s.lib \ $(DIST)\lib\DebugRobot.lib \ $(DIST)\lib\xpcom.lib \ diff --git a/mozilla/webshell/tests/viewer/nsViewerApp.cpp b/mozilla/webshell/tests/viewer/nsViewerApp.cpp index 250671c2b6c..39aa2a0ee84 100644 --- a/mozilla/webshell/tests/viewer/nsViewerApp.cpp +++ b/mozilla/webshell/tests/viewer/nsViewerApp.cpp @@ -46,7 +46,6 @@ #include "plstr.h" #include "prenv.h" #include "nsIScriptGlobalObject.h" -#include "nsAppFileLocationProvider.h" // Needed for Dialog GUI #include "nsICheckButton.h" @@ -303,25 +302,6 @@ nsViewerApp::Initialize(int argc, char** argv) { nsresult rv; - // Create and register a directory service provider - nsAppFileLocationProvider* appFileLocProvider; - appFileLocProvider = new nsAppFileLocationProvider; - if (!appFileLocProvider) { - NS_ASSERTION(PR_FALSE, "Could not create nsAppFileLocationProvider\n"); - return NS_ERROR_OUT_OF_MEMORY; - } - NS_WITH_SERVICE(nsIDirectoryService, directoryService, NS_DIRECTORY_SERVICE_CONTRACTID, &rv); - if (!directoryService) { - NS_ASSERTION(PR_FALSE, "failed to get directory service"); - return rv; - } - // RegisterProvider will AddRef it and own it - notice we have not AddRef'd it - rv = directoryService->RegisterProvider(appFileLocProvider); - if (NS_FAILED(rv)) { - NS_ASSERTION(PR_FALSE, "Could not register directory service provider\n"); - return rv; - } - rv = SetupRegistry(); if (NS_OK != rv) { return rv; diff --git a/mozilla/xpcom/build/nsXPComInit.cpp b/mozilla/xpcom/build/nsXPComInit.cpp index 9472c2916c1..c5cb749f001 100644 --- a/mozilla/xpcom/build/nsXPComInit.cpp +++ b/mozilla/xpcom/build/nsXPComInit.cpp @@ -65,6 +65,7 @@ #include "nsLocalFile.h" #include "nsDirectoryService.h" #include "nsDirectoryServiceDefs.h" +#include "nsAppFileLocationProvider.h" #include "nsICategoryManager.h" #include "nsAtomService.h" @@ -199,14 +200,13 @@ extern PRBool gShuttingDown; nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result, nsIFile* binDirectory) { - return NS_InitXPCOM2(nsnull, result, binDirectory); + return NS_InitXPCOM2(result, binDirectory, nsnull); } -nsresult NS_COM NS_InitXPCOM2(const char* productName, - nsIServiceManager* *result, - nsIFile* binDirectory -) +nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result, + nsIFile* binDirectory, + nsIDirectoryServiceProvider* appFileLocationProvider) { nsresult rv = NS_OK; @@ -261,7 +261,7 @@ nsresult NS_COM NS_InitXPCOM2(const char* productName, if (!dirService) return NS_ERROR_NO_INTERFACE; - rv = dirService->Init(productName); + rv = dirService->Init(); if (NS_FAILED(rv)) return rv; @@ -284,7 +284,14 @@ nsresult NS_COM NS_InitXPCOM2(const char* productName, nsSpecialSystemDirectory::Set(nsSpecialSystemDirectory::Moz_BinDirectory, &spec); } - + if (!appFileLocationProvider) { + appFileLocationProvider = new nsAppFileLocationProvider; + if (!appFileLocationProvider) + return NS_ERROR_OUT_OF_MEMORY; + } + rv = dirService->RegisterProvider(appFileLocationProvider); + if (NS_FAILED(rv)) return rv; + rv = compMgr->Init(); if (NS_FAILED(rv)) diff --git a/mozilla/xpcom/components/nsIServiceManager.h b/mozilla/xpcom/components/nsIServiceManager.h index 1bee4e73d1f..74c3681848a 100644 --- a/mozilla/xpcom/components/nsIServiceManager.h +++ b/mozilla/xpcom/components/nsIServiceManager.h @@ -32,6 +32,7 @@ #endif class nsIShutdownListener; +class nsIDirectoryServiceProvider; #define NS_ISERVICEMANAGER_IID \ { /* cf0df3b0-3401-11d2-8163-006008119d7a */ \ @@ -368,8 +369,11 @@ NS_NewServiceManager(nsIServiceManager* *result); extern NS_COM nsresult NS_InitXPCOM(nsIServiceManager* *result, nsIFile* binDirectory); +// appFileLocationProvider provides application relative file locations. +// If nsnull is passed, the default implementation will be created and used. + extern NS_COM nsresult -NS_InitXPCOM2(const char* productName, nsIServiceManager* *result, nsIFile* binDirectory); +NS_InitXPCOM2(nsIServiceManager* *result, nsIFile* binDirectory, nsIDirectoryServiceProvider* appFileLocationProvider); //////////////////////////////////////////////////////////////////////////////// // Shutdown of XPCOM. XPCOM hosts an observer (NS_XPCOM_SHUTDOWN_OBSERVER_ID) diff --git a/mozilla/xpcom/components/nsRegistry.cpp b/mozilla/xpcom/components/nsRegistry.cpp index a510429259e..3a044addfda 100644 --- a/mozilla/xpcom/components/nsRegistry.cpp +++ b/mozilla/xpcom/components/nsRegistry.cpp @@ -24,6 +24,7 @@ #include "nsIEnumerator.h" #include "nsDirectoryService.h" #include "nsDirectoryServiceDefs.h" +#include "nsAppDirectoryServiceDefs.h" #include "NSReg.h" #include "prmem.h" #include "prlock.h" @@ -537,7 +538,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) NS_GET_IID(nsIProperties), getter_AddRefs(directoryService)); if (NS_FAILED(rv)) return rv; - directoryService->Get(NS_XPCOM_APPLICATION_REGISTRY_FILE, NS_GET_IID(nsIFile), + directoryService->Get(NS_APP_APPLICATION_REGISTRY_FILE, NS_GET_IID(nsIFile), getter_AddRefs(registryLocation)); if (registryLocation) diff --git a/mozilla/xpcom/io/MANIFEST b/mozilla/xpcom/io/MANIFEST index a594e683504..f4dcf5dc60f 100644 --- a/mozilla/xpcom/io/MANIFEST +++ b/mozilla/xpcom/io/MANIFEST @@ -14,3 +14,4 @@ nsILocalFileMac.h nsDirectoryService.h nsDirectoryServiceDefs.h nsStringIO.h +nsAppDirectoryServiceDefs.h diff --git a/mozilla/xpcom/io/Makefile.in b/mozilla/xpcom/io/Makefile.in index 0b2e5c3b213..56ccd8f315e 100644 --- a/mozilla/xpcom/io/Makefile.in +++ b/mozilla/xpcom/io/Makefile.in @@ -50,6 +50,7 @@ CPPSRCS = \ nsStorageStream.cpp \ nsScriptableInputStream.cpp \ nsByteArrayInputStream.cpp \ + nsAppFileLocationProvider.cpp \ $(NULL) ifeq ($(MOZ_WIDGET_TOOLKIT),os2) @@ -62,6 +63,7 @@ EXPORTS = \ nsEscape.h \ nsDirectoryService.h \ nsDirectoryServiceDefs.h \ + nsAppDirectoryServiceDefs.h \ nsLocalFile.h \ nsLinebreakConverter.h \ nsFileSpec.h \ diff --git a/mozilla/xpcom/io/makefile.win b/mozilla/xpcom/io/makefile.win index 9c25d01c755..a47fafe32e4 100644 --- a/mozilla/xpcom/io/makefile.win +++ b/mozilla/xpcom/io/makefile.win @@ -39,6 +39,7 @@ EXPORTS = \ nsScriptableInputStream.h \ nsDirectoryService.h \ nsDirectoryServiceDefs.h \ + nsAppDirectoryServiceDefs.h \ nsStringIO.h \ $(NULL) @@ -95,6 +96,7 @@ CPP_OBJS = \ .\$(OBJDIR)\nsFileSpecStreaming.obj \ .\$(OBJDIR)\nsSpecialSystemDirectory.obj \ .\$(OBJDIR)\nsByteArrayInputStream.obj \ + .\$(OBJDIR)\nsAppFileLocationProvider.obj \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/xpcom/io/nsAppDirectoryServiceDefs.h b/mozilla/xpcom/io/nsAppDirectoryServiceDefs.h index dcb27d0023f..0cf8007d1a4 100755 --- a/mozilla/xpcom/io/nsAppDirectoryServiceDefs.h +++ b/mozilla/xpcom/io/nsAppDirectoryServiceDefs.h @@ -29,16 +29,18 @@ // Defines property names for directories available from standard nsIDirectoryServiceProviders. // These keys are not guaranteed to exist because the nsIDirectoryServiceProviders which // provide them are optional. -// System and XPCOM level properties are defined in mozilla\xpcom\io\nsDirectoryServiceDefs.h. +// System and XPCOM level properties are defined in nsDirectoryServiceDefs.h. // //======================================================================================== // -------------------------------------------------------------------------------------- // Files and directories which exist on a per-product basis -// These locations are typically provided by mozilla\xpfe\appfilelocprovider // -------------------------------------------------------------------------------------- +#define NS_APP_APPLICATION_REGISTRY_FILE "AppRegF" +#define NS_APP_APPLICATION_REGISTRY_DIR "AppRegD" + #define NS_APP_DEFAULTS_50_DIR "DefRt" // The root dir of all defaults dirs #define NS_APP_PREF_DEFAULTS_50_DIR "PrfDef" #define NS_APP_PROFILE_DEFAULTS_50_DIR "profDef" // The profile defaults of the "current" diff --git a/mozilla/xpcom/io/nsAppFileLocationProvider.cpp b/mozilla/xpcom/io/nsAppFileLocationProvider.cpp index 218959c28ee..44c9941e1be 100755 --- a/mozilla/xpcom/io/nsAppFileLocationProvider.cpp +++ b/mozilla/xpcom/io/nsAppFileLocationProvider.cpp @@ -31,7 +31,6 @@ #include "nsXPIDLString.h" #include "nsIChromeRegistry.h" -static nsresult GetDefaultUserProfileRoot(nsILocalFile **aLocalFile); #if defined(XP_MAC) #include @@ -66,6 +65,22 @@ static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID); // WARNING: These hard coded names need to go away. They need to // come from localizable resources +#ifdef XP_MAC +#define APP_REGISTRY_NAME "Application Registry" +#elif defined(XP_WIN) || defined(XP_OS2) +#define APP_REGISTRY_NAME "registry.dat" +#else +#define APP_REGISTRY_NAME "appreg" +#endif + +// define default product directory +#if defined(XP_WIN) || defined(XP_MAC) || defined(XP_OS2) || defined(XP_BEOS) +#define DEFAULT_PRODUCT_DIR "Mozilla" +#elif defined (XP_UNIX) +#define DEFAULT_PRODUCT_DIR ".mozilla" +#endif + + #if XP_MAC #define DEFAULTS_DIR_NAME "Defaults" #define DEFAULTS_PREF_DIR_NAME "Pref" @@ -84,24 +99,6 @@ static NS_DEFINE_CID(kChromeRegistryCID, NS_CHROMEREGISTRY_CID); #define SEARCH_DIR_NAME "searchplugins" #endif -//***************************************************************************** -// nsAppFileLocationProvider::Static Variables -//***************************************************************************** - -PRInt32 nsAppFileLocationProvider::sInstanceCount = 0; - -nsIAtom* nsAppFileLocationProvider::sApp_DefaultsFolder50 = nsnull; -nsIAtom* nsAppFileLocationProvider::sApp_PrefDefaultsFolder50 = nsnull; -nsIAtom* nsAppFileLocationProvider::sApp_ProfileDefaultsFolder50 = nsnull; -nsIAtom* nsAppFileLocationProvider::sApp_ProfileDefaultsNoLocFolder50 = nsnull; - -nsIAtom* nsAppFileLocationProvider::sApp_DefaultUserProfileRoot50 = nsnull; - -nsIAtom* nsAppFileLocationProvider::sApp_ResDirectory = nsnull; -nsIAtom* nsAppFileLocationProvider::sApp_ChromeDirectory = nsnull; -nsIAtom* nsAppFileLocationProvider::sApp_PluginsDirectory = nsnull; - -nsIAtom* nsAppFileLocationProvider::sApp_SearchDirectory50 = nsnull; //***************************************************************************** // nsAppFileLocationProvider::Constructor/Destructor @@ -110,60 +107,10 @@ nsIAtom* nsAppFileLocationProvider::sApp_SearchDirectory50 = nsnull; nsAppFileLocationProvider::nsAppFileLocationProvider() { NS_INIT_ISUPPORTS(); - - if (sInstanceCount++ == 0) { - - // Defaults - sApp_DefaultsFolder50 = NS_NewAtom(NS_APP_DEFAULTS_50_DIR); - sApp_PrefDefaultsFolder50 = NS_NewAtom(NS_APP_PREF_DEFAULTS_50_DIR); - sApp_ProfileDefaultsFolder50 = NS_NewAtom(NS_APP_PROFILE_DEFAULTS_50_DIR); - sApp_ProfileDefaultsNoLocFolder50 = NS_NewAtom(NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR); - - // Profile Root - sApp_DefaultUserProfileRoot50 = NS_NewAtom(NS_APP_USER_PROFILES_ROOT_DIR); - - // Application Directories - sApp_ResDirectory = NS_NewAtom(NS_APP_RES_DIR); - sApp_ChromeDirectory = NS_NewAtom(NS_APP_CHROME_DIR); - sApp_PluginsDirectory = NS_NewAtom(NS_APP_PLUGINS_DIR); - - // Search - sApp_SearchDirectory50 = NS_NewAtom(NS_APP_SEARCH_DIR); - } - - nsresult rv; - - // Get the mozilla bin directory - // 1. Check the directory service first for NS_XPCOM_CURRENT_PROCESS_DIR - // This will be set if a directory was passed to NS_InitXPCOM - // 2. If that doesn't work, set it to be the current process directory - - NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) - rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory)); - - if (NS_FAILED(rv)) { - rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory)); - } } nsAppFileLocationProvider::~nsAppFileLocationProvider() { - if (--sInstanceCount == 0) { - - NS_IF_RELEASE(sApp_DefaultsFolder50); - NS_IF_RELEASE(sApp_PrefDefaultsFolder50); - NS_IF_RELEASE(sApp_ProfileDefaultsFolder50); - NS_IF_RELEASE(sApp_ProfileDefaultsNoLocFolder50); - - NS_IF_RELEASE(sApp_DefaultUserProfileRoot50); - - NS_IF_RELEASE(sApp_ResDirectory); - NS_IF_RELEASE(sApp_ChromeDirectory); - NS_IF_RELEASE(sApp_PluginsDirectory); - - NS_IF_RELEASE(sApp_SearchDirectory50); - } } @@ -173,7 +120,6 @@ nsAppFileLocationProvider::~nsAppFileLocationProvider() NS_IMPL_ISUPPORTS1(nsAppFileLocationProvider, nsIDirectoryServiceProvider) - //***************************************************************************** // nsAppFileLocationProvider::nsIDirectoryServiceProvider //***************************************************************************** @@ -187,16 +133,23 @@ nsAppFileLocationProvider::GetFile(const char *prop, PRBool *persistant, nsIFile *_retval = nsnull; *persistant = PR_TRUE; - nsIAtom* inAtom = NS_NewAtom(prop); - NS_ENSURE_TRUE(inAtom, NS_ERROR_OUT_OF_MEMORY); - - if (inAtom == sApp_DefaultsFolder50) + if (nsCRT::strcmp(prop, NS_APP_APPLICATION_REGISTRY_DIR) == 0) + { + rv = GetProductDirectory(getter_AddRefs(localFile)); + } + else if (nsCRT::strcmp(prop, NS_APP_APPLICATION_REGISTRY_FILE) == 0) + { + rv = GetProductDirectory(getter_AddRefs(localFile)); + if (NS_SUCCEEDED(rv)) + rv = localFile->Append(APP_REGISTRY_NAME); + } + else if (nsCRT::strcmp(prop, NS_APP_DEFAULTS_50_DIR) == 0) { rv = CloneMozBinDirectory(getter_AddRefs(localFile)); if (NS_SUCCEEDED(rv)) rv = localFile->AppendRelativePath(DEFAULTS_DIR_NAME); } - else if (inAtom == sApp_PrefDefaultsFolder50) + else if (nsCRT::strcmp(prop, NS_APP_PREF_DEFAULTS_50_DIR) == 0) { rv = CloneMozBinDirectory(getter_AddRefs(localFile)); if (NS_SUCCEEDED(rv)) { @@ -205,7 +158,7 @@ nsAppFileLocationProvider::GetFile(const char *prop, PRBool *persistant, nsIFile rv = localFile->AppendRelativePath(DEFAULTS_PREF_DIR_NAME); } } - else if (inAtom == sApp_ProfileDefaultsFolder50) + else if (nsCRT::strcmp(prop, NS_APP_PROFILE_DEFAULTS_50_DIR) == 0) { rv = CloneMozBinDirectory(getter_AddRefs(localFile)); if (NS_SUCCEEDED(rv)) { @@ -221,7 +174,7 @@ nsAppFileLocationProvider::GetFile(const char *prop, PRBool *persistant, nsIFile } } } - else if (inAtom == sApp_ProfileDefaultsNoLocFolder50) + else if (nsCRT::strcmp(prop, NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR) == 0) { rv = CloneMozBinDirectory(getter_AddRefs(localFile)); if (NS_SUCCEEDED(rv)) { @@ -230,37 +183,35 @@ nsAppFileLocationProvider::GetFile(const char *prop, PRBool *persistant, nsIFile rv = localFile->AppendRelativePath(DEFAULTS_PROFILE_DIR_NAME); } } - else if (inAtom == sApp_DefaultUserProfileRoot50) + else if (nsCRT::strcmp(prop, NS_APP_USER_PROFILES_ROOT_DIR) == 0) { rv = GetDefaultUserProfileRoot(getter_AddRefs(localFile)); } - else if (inAtom == sApp_ResDirectory) + else if (nsCRT::strcmp(prop, NS_APP_RES_DIR) == 0) { rv = CloneMozBinDirectory(getter_AddRefs(localFile)); if (NS_SUCCEEDED(rv)) rv = localFile->AppendRelativePath(RES_DIR_NAME); } - else if (inAtom == sApp_ChromeDirectory) + else if (nsCRT::strcmp(prop, NS_APP_CHROME_DIR) == 0) { rv = CloneMozBinDirectory(getter_AddRefs(localFile)); if (NS_SUCCEEDED(rv)) rv = localFile->AppendRelativePath(CHROME_DIR_NAME); } - else if (inAtom == sApp_PluginsDirectory) + else if (nsCRT::strcmp(prop, NS_APP_PLUGINS_DIR) == 0) { rv = CloneMozBinDirectory(getter_AddRefs(localFile)); if (NS_SUCCEEDED(rv)) rv = localFile->AppendRelativePath(PLUGINS_DIR_NAME); } - else if (inAtom == sApp_SearchDirectory50) + else if (nsCRT::strcmp(prop, NS_APP_SEARCH_DIR) == 0) { rv = CloneMozBinDirectory(getter_AddRefs(localFile)); if (NS_SUCCEEDED(rv)) rv = localFile->AppendRelativePath(SEARCH_DIR_NAME); } - NS_RELEASE(inAtom); - if (localFile && NS_SUCCEEDED(rv)) return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)_retval); @@ -270,11 +221,30 @@ nsAppFileLocationProvider::GetFile(const char *prop, PRBool *persistant, nsIFile NS_METHOD nsAppFileLocationProvider::CloneMozBinDirectory(nsILocalFile **aLocalFile) { - NS_ENSURE_TRUE(mMozBinDirectory, NS_ERROR_FAILURE); NS_ENSURE_ARG_POINTER(aLocalFile); + nsresult rv; + + if (!mMozBinDirectory) + { + // Get the mozilla bin directory + // 1. Check the directory service first for NS_XPCOM_CURRENT_PROCESS_DIR + // This will be set if a directory was passed to NS_InitXPCOM + // 2. If that doesn't work, set it to be the current process directory + + NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_CONTRACTID, &rv); + if (NS_FAILED(rv)) + return rv; + + rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory)); + if (NS_FAILED(rv)) { + rv = directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mMozBinDirectory)); + if (NS_FAILED(rv)) + return rv; + } + } nsCOMPtr aFile; - nsresult rv = mMozBinDirectory->Clone(getter_AddRefs(aFile)); + rv = mMozBinDirectory->Clone(getter_AddRefs(aFile)); if (NS_FAILED(rv)) return rv; @@ -286,34 +256,15 @@ NS_METHOD nsAppFileLocationProvider::CloneMozBinDirectory(nsILocalFile **aLocalF return NS_OK; } -//**************************************************************************************** -// Static Routines -//**************************************************************************************** - -static nsresult GetChromeLocale(PRUnichar** localeName) -{ - NS_ENSURE_ARG_POINTER(localeName); - - nsresult rv; - *localeName = nsnull; - nsCOMPtr chromeRegistry = do_GetService(kChromeRegistryCID, &rv); - - if (NS_SUCCEEDED(rv)) { - nsString tmpstr; tmpstr.AssignWithConversion("navigator"); - rv = chromeRegistry->GetSelectedLocale(tmpstr.GetUnicode(), localeName); - } - return rv; -} - //---------------------------------------------------------------------------------------- -// GetDefaultUserProfileRoot - Gets the directory which contains each user profile dir +// GetProductDirectory - Gets the directory which contains the application data folder // // UNIX : ~/.mozilla/ -// WIN : \Mozilla\Users50 -// Mac : :Documents:Mozilla:Users50: +// WIN : \Mozilla +// Mac : :Documents:Mozilla: //---------------------------------------------------------------------------------------- -static nsresult GetDefaultUserProfileRoot(nsILocalFile **aLocalFile) +NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsILocalFile **aLocalFile) { NS_ENSURE_ARG_POINTER(aLocalFile); @@ -347,12 +298,6 @@ static nsresult GetDefaultUserProfileRoot(nsILocalFile **aLocalFile) #elif defined(XP_UNIX) rv = NS_NewLocalFile(PR_GetEnv("HOME"), PR_TRUE, getter_AddRefs(localDir)); if (NS_FAILED(rv)) return rv; - rv = localDir->AppendRelativePath(".mozilla"); - if (NS_FAILED(rv)) return rv; - rv = localDir->Exists(&exists); - if (NS_SUCCEEDED(rv) && !exists) - rv = localDir->Create(nsIFile::DIRECTORY_TYPE, 0775); - if (NS_FAILED(rv)) return rv; #elif defined(XP_BEOS) char path[MAXPATHLEN]; find_directory(B_USER_SETTINGS_DIRECTORY, 0, 0, path, MAXPATHLEN); @@ -364,20 +309,44 @@ static nsresult GetDefaultUserProfileRoot(nsILocalFile **aLocalFile) path[len+1] = '\0'; rv = NS_NewLocalFile(path, PR_TRUE, getter_AddRefs(localDir)); if (NS_FAILED(rv)) return rv; - rv = localDir->AppendRelativePath("mozilla"); +#else +#error dont_know_how_to_get_product_dir_on_your_platform +#endif + + rv = localDir->AppendRelativePath(DEFAULT_PRODUCT_DIR); if (NS_FAILED(rv)) return rv; rv = localDir->Exists(&exists); if (NS_SUCCEEDED(rv) && !exists) - rv = localDir->Create(nsIFile::DIRECTORY_TYPE, 0); + rv = localDir->Create(nsIFile::DIRECTORY_TYPE, 0775); + if (NS_FAILED(rv)) return rv; + + *aLocalFile = localDir; + NS_ADDREF(*aLocalFile); + + return rv; +} + + +//---------------------------------------------------------------------------------------- +// GetDefaultUserProfileRoot - Gets the directory which contains each user profile dir +// +// UNIX : ~/.mozilla/ +// WIN : \Mozilla\Users50 +// Mac : :Documents:Mozilla:Users50: +//---------------------------------------------------------------------------------------- +NS_METHOD nsAppFileLocationProvider::GetDefaultUserProfileRoot(nsILocalFile **aLocalFile) +{ + NS_ENSURE_ARG_POINTER(aLocalFile); + + nsresult rv; + PRBool exists; + nsCOMPtr localDir; + + rv = GetProductDirectory(getter_AddRefs(localDir)); if (NS_FAILED(rv)) return rv; -#else -#error dont_know_how_to_do_profiles_on_your_platform -#endif #if defined(XP_MAC) || defined(XP_OS2) || defined(XP_PC) // These 3 platforms share this part of the path - do them as one - rv = localDir->AppendRelativePath("Mozilla"); - if (NS_FAILED(rv)) return rv; rv = localDir->AppendRelativePath("Users50"); if (NS_FAILED(rv)) return rv; rv = localDir->Exists(&exists); @@ -392,3 +361,21 @@ static nsresult GetDefaultUserProfileRoot(nsILocalFile **aLocalFile) return rv; } +//**************************************************************************************** +// Static Routines +//**************************************************************************************** + +static nsresult GetChromeLocale(PRUnichar** localeName) +{ + NS_ENSURE_ARG_POINTER(localeName); + + nsresult rv; + *localeName = nsnull; + nsCOMPtr chromeRegistry = do_GetService(kChromeRegistryCID, &rv); + + if (NS_SUCCEEDED(rv)) { + nsString tmpstr; tmpstr.AssignWithConversion("navigator"); + rv = chromeRegistry->GetSelectedLocale(tmpstr.GetUnicode(), localeName); + } + return rv; +} diff --git a/mozilla/xpcom/io/nsAppFileLocationProvider.h b/mozilla/xpcom/io/nsAppFileLocationProvider.h index f853fecb006..78aa6410ef5 100755 --- a/mozilla/xpcom/io/nsAppFileLocationProvider.h +++ b/mozilla/xpcom/io/nsAppFileLocationProvider.h @@ -25,7 +25,6 @@ #include "nsIDirectoryService.h" #include "nsILocalFile.h" -class nsIAtom; class nsIFile; //***************************************************************************** @@ -44,21 +43,8 @@ protected: virtual ~nsAppFileLocationProvider(); NS_METHOD CloneMozBinDirectory(nsILocalFile **aLocalFile); + NS_METHOD GetProductDirectory(nsILocalFile **aLocalFile); + NS_METHOD GetDefaultUserProfileRoot(nsILocalFile **aLocalFile); - static PRInt32 sInstanceCount; - - static nsIAtom* sApp_PrefDefaultsFolder50; - static nsIAtom* sApp_ProfileDefaultsFolder50; - static nsIAtom* sApp_ProfileDefaultsNoLocFolder50; - - static nsIAtom* sApp_DefaultUserProfileRoot50; - - static nsIAtom* sApp_ResDirectory; - static nsIAtom* sApp_DefaultsFolder50; - static nsIAtom* sApp_ChromeDirectory; - static nsIAtom* sApp_PluginsDirectory; - - static nsIAtom* sApp_SearchDirectory50; - nsCOMPtr mMozBinDirectory; }; diff --git a/mozilla/xpcom/io/nsDirectoryService.cpp b/mozilla/xpcom/io/nsDirectoryService.cpp index 619b5b78ee3..c289b3cdd14 100644 --- a/mozilla/xpcom/io/nsDirectoryService.cpp +++ b/mozilla/xpcom/io/nsDirectoryService.cpp @@ -281,8 +281,6 @@ nsDirectoryService::GetCurrentProcessDirectory(nsILocalFile** aFile) nsIAtom* nsDirectoryService::sCurrentProcess = nsnull; -nsIAtom* nsDirectoryService::sAppRegistryDirectory = nsnull; -nsIAtom* nsDirectoryService::sAppRegistry = nsnull; nsIAtom* nsDirectoryService::sComponentRegistry = nsnull; nsIAtom* nsDirectoryService::sComponentDirectory = nsnull; nsIAtom* nsDirectoryService::sOS_DriveDirectory = nsnull; @@ -369,7 +367,7 @@ nsDirectoryService::Create(nsISupports *outer, REFNSIID aIID, void **aResult) } nsresult -nsDirectoryService::Init(const char *productName) +nsDirectoryService::Init() { nsresult rv; mHashtable = new nsSupportsHashtable(256, PR_TRUE); @@ -379,13 +377,9 @@ nsDirectoryService::Init(const char *productName) rv = NS_NewISupportsArray(getter_AddRefs(mProviders)); if (NS_FAILED(rv)) return rv; - mProductName = productName; - nsDirectoryService::sCurrentProcess = NS_NewAtom(NS_XPCOM_CURRENT_PROCESS_DIR); nsDirectoryService::sComponentRegistry = NS_NewAtom(NS_XPCOM_COMPONENT_REGISTRY_FILE); nsDirectoryService::sComponentDirectory = NS_NewAtom(NS_XPCOM_COMPONENT_DIR); - nsDirectoryService::sAppRegistryDirectory = NS_NewAtom(NS_XPCOM_APPLICATION_REGISTRY_DIR); - nsDirectoryService::sAppRegistry = NS_NewAtom(NS_XPCOM_APPLICATION_REGISTRY_FILE); nsDirectoryService::sOS_DriveDirectory = NS_NewAtom(NS_OS_DRIVE_DIR); nsDirectoryService::sOS_TemporaryDirectory = NS_NewAtom(NS_OS_TEMP_DIR); @@ -465,8 +459,6 @@ nsDirectoryService::~nsDirectoryService() delete mHashtable; NS_IF_RELEASE(nsDirectoryService::sCurrentProcess); - NS_IF_RELEASE(nsDirectoryService::sAppRegistryDirectory); - NS_IF_RELEASE(nsDirectoryService::sAppRegistry); NS_IF_RELEASE(nsDirectoryService::sComponentRegistry); NS_IF_RELEASE(nsDirectoryService::sComponentDirectory); NS_IF_RELEASE(nsDirectoryService::sOS_DriveDirectory); @@ -722,74 +714,6 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret { rv = GetCurrentProcessDirectory(getter_AddRefs(localFile)); } - else if (inAtom == nsDirectoryService::sAppRegistryDirectory) - { - nsCOMPtr homeDir; - GetFile(HOME_DIR, persistent, getter_AddRefs(homeDir)); - -#if defined(XP_WIN) - PRBool dirExists = PR_FALSE; - PRBool invalidHome = PR_FALSE; - if (homeDir) - { - homeDir->Exists(&dirExists); - if (!dirExists) - invalidHome = PR_TRUE; - } - else - { - // We got a null value from file service. - // Home directory is not available/set. - invalidHome = PR_TRUE; - } - - // If home directory is invalid or absent, use windows - // directory as fall back. - if (invalidHome) - GetFile(NS_WIN_WINDOWS_DIR,persistent, getter_AddRefs(homeDir)); -#endif - if (homeDir) - { - localFile = do_QueryInterface(homeDir); - - nsCString productName = mProductName; - - if (!(productName.mLength)) - productName = DEFAULT_PRODUCT_DIR; - - nsCString temp = productName; - if (localFile) - rv = localFile->Append(temp); - - if (NS_SUCCEEDED(rv)) - { - - // Create the new directory - PRBool newDirExists = PR_FALSE; - localFile->Exists(&newDirExists); - - if (!newDirExists) - { - rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0755); - } - } - } - else - rv = NS_ERROR_FAILURE; - } - else if (inAtom == nsDirectoryService::sAppRegistry) - { - nsCOMPtr registryDir; - GetFile(NS_XPCOM_APPLICATION_REGISTRY_DIR, persistent, getter_AddRefs(registryDir)); - - if (registryDir) - { - localFile = do_QueryInterface(registryDir); - rv = localFile->Append(APP_REGISTRY_NAME); - } - else - rv = NS_ERROR_FAILURE; - } else if (inAtom == nsDirectoryService::sComponentRegistry) { rv = GetCurrentProcessDirectory(getter_AddRefs(localFile)); diff --git a/mozilla/xpcom/io/nsDirectoryService.h b/mozilla/xpcom/io/nsDirectoryService.h index 56cf5156720..dbcce243228 100644 --- a/mozilla/xpcom/io/nsDirectoryService.h +++ b/mozilla/xpcom/io/nsDirectoryService.h @@ -37,8 +37,6 @@ class nsDirectoryService : public nsIDirectoryService, public nsIProperties, pub NS_DEFINE_STATIC_CID_ACCESSOR(NS_DIRECTORY_SERVICE_CID); - nsresult Init(); - // nsISupports interface NS_DECL_ISUPPORTS @@ -62,11 +60,7 @@ private: nsSupportsHashtable* mHashtable; nsCOMPtr mProviders; - nsCString mProductName; - static nsIAtom *sCurrentProcess; - static nsIAtom *sAppRegistryDirectory; - static nsIAtom *sAppRegistry; static nsIAtom *sComponentRegistry; static nsIAtom *sComponentDirectory; static nsIAtom *sOS_DriveDirectory; diff --git a/mozilla/xpcom/io/nsDirectoryServiceDefs.h b/mozilla/xpcom/io/nsDirectoryServiceDefs.h index 7af921f89be..ee922f8c2a8 100755 --- a/mozilla/xpcom/io/nsDirectoryServiceDefs.h +++ b/mozilla/xpcom/io/nsDirectoryServiceDefs.h @@ -28,7 +28,7 @@ // // Defines the property names for directories available from nsIDirectoryService. These // dirs are always available even if no nsIDirectoryServiceProviders have been registered -// with the service. Application level keys are defined in mozilla\xpfe\appfilelocprovider\. +// with the service. Application level keys are defined in nsAppDirectoryServiceDefs.h. // //======================================================================================== @@ -40,8 +40,6 @@ #define NS_XPCOM_CURRENT_PROCESS_DIR "CurProcD" #define NS_XPCOM_COMPONENT_REGISTRY_FILE "ComRegF" #define NS_XPCOM_COMPONENT_DIR "ComsD" -#define NS_XPCOM_APPLICATION_REGISTRY_FILE "AppRegF" -#define NS_XPCOM_APPLICATION_REGISTRY_DIR "AppRegD" #define NS_OS_HOME_DIR "Home" #define NS_OS_DRIVE_DIR "DrvD" diff --git a/mozilla/xpcom/io/nsIDirectoryService.idl b/mozilla/xpcom/io/nsIDirectoryService.idl index 9da06e6e84d..45fe8dfa3f4 100644 --- a/mozilla/xpcom/io/nsIDirectoryService.idl +++ b/mozilla/xpcom/io/nsIDirectoryService.idl @@ -32,7 +32,7 @@ interface nsIDirectoryServiceProvider: nsISupports [scriptable, uuid(57a66a60-d43a-11d3-8cc2-00609792278c)] interface nsIDirectoryService: nsISupports { - void init(in string productName); + void init(); void registerProvider(in nsIDirectoryServiceProvider prov); void unregisterProvider(in nsIDirectoryServiceProvider prov); }; diff --git a/mozilla/xpcom/macbuild/xpcomPPC.mcp b/mozilla/xpcom/macbuild/xpcomPPC.mcp index 0247d885aea..eac05896650 100644 Binary files a/mozilla/xpcom/macbuild/xpcomPPC.mcp and b/mozilla/xpcom/macbuild/xpcomPPC.mcp differ diff --git a/mozilla/xpfe/bootstrap/Makefile.in b/mozilla/xpfe/bootstrap/Makefile.in index cffa493892d..4e3fa8bcfe3 100644 --- a/mozilla/xpfe/bootstrap/Makefile.in +++ b/mozilla/xpfe/bootstrap/Makefile.in @@ -36,7 +36,7 @@ PROGRAM = mozilla-bin endif EXTRA_DSO_LIBS = gkgfx \ - xpfelocation_s mpfilelocprovider_s \ + mpfilelocprovider_s \ $(NULL) CPPSRCS = \ diff --git a/mozilla/xpfe/bootstrap/macbuild/apprunner.mcp b/mozilla/xpfe/bootstrap/macbuild/apprunner.mcp index 3e11c3a135f..24d524be24a 100644 Binary files a/mozilla/xpfe/bootstrap/macbuild/apprunner.mcp and b/mozilla/xpfe/bootstrap/macbuild/apprunner.mcp differ diff --git a/mozilla/xpfe/bootstrap/makefile.win b/mozilla/xpfe/bootstrap/makefile.win index bd240521a82..017fd90bee0 100644 --- a/mozilla/xpfe/bootstrap/makefile.win +++ b/mozilla/xpfe/bootstrap/makefile.win @@ -100,7 +100,6 @@ LLIBS= \ $(DIST)\lib\xpcom.lib \ $(DIST)\lib\js3250.lib \ $(DIST)\lib\gkgfxwin.lib \ - $(DIST)\lib\appfilelocprovider_s.lib \ $(DIST)\lib\mpfilelocprovider_s.lib \ !ifdef GC_LEAK_DETECTOR $(DIST)\lib\boehm.lib \ diff --git a/mozilla/xpfe/bootstrap/nsAppRunner.cpp b/mozilla/xpfe/bootstrap/nsAppRunner.cpp index 8d05e22ee5a..e55a683ac1d 100644 --- a/mozilla/xpfe/bootstrap/nsAppRunner.cpp +++ b/mozilla/xpfe/bootstrap/nsAppRunner.cpp @@ -57,7 +57,6 @@ #include "nsIContentHandler.h" #include "nsIBrowserInstance.h" #include "nsIEventQueueService.h" -#include "nsAppFileLocationProvider.h" #include "nsMPFileLocProvider.h" #include "nsDirectoryServiceDefs.h" #include "nsIHTTPProtocolHandler.h" @@ -714,32 +713,6 @@ static nsresult Ensure1Window( nsICmdLineService* cmdLineArgs) return rv; } -static nsresult CreateAndRegisterDirectoryService() -{ - nsresult rv = NS_OK; - // Create and register a directory service provider - nsAppFileLocationProvider* appFileLocProvider = new nsAppFileLocationProvider; - - if (!appFileLocProvider) { - NS_ASSERTION(PR_FALSE, "Could not create nsAppFileLocationProvider\n"); - return NS_ERROR_OUT_OF_MEMORY; - } - - nsCOMPtr directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); - if (!directoryService) { - NS_ASSERTION(PR_FALSE, "failed to get directory service"); - return rv; - } - // RegisterProvider will AddRef it and own it - notice we have not AddRef'd it - rv = directoryService->RegisterProvider(appFileLocProvider); - if (NS_FAILED(rv)) { - NS_ASSERTION(PR_FALSE, "Could not register directory service provider\n"); - return rv; - } - - return rv; -} - // Do the righe thing to provide locations depending on whether an // application is standalone or not static nsresult InitializeProfileService(nsICmdLineService *cmdLineArgs) @@ -875,10 +848,6 @@ static nsresult main1(int argc, char* argv[], nsISupports *nativeApp ) } } - rv = CreateAndRegisterDirectoryService(); - if (NS_FAILED(rv)) - return rv; - //---------------------------------------------------------------- // XPInstall needs to clean up after any updates that couldn't // be completed because components were in use. This must be done