Bug 38626 - Remove references to nsFileLocations. r=valeski/sr=alecf

This commit is contained in:
ccarlen%netscape.com 2001-05-21 22:36:18 +00:00
Родитель 072fca89ad
Коммит abcdbf0e4a
15 изменённых файлов: 69 добавлений и 69 удалений

Просмотреть файл

@ -32,13 +32,12 @@
#include "nsIDirectoryService.h" #include "nsIDirectoryService.h"
#include "nsIProperties.h" #include "nsIProperties.h"
#include "nsIFile.h" #include "nsIFile.h"
#include "nsStdURL.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#include "nsIFileSpec.h" #include "nsIFileSpec.h"
#include "nsAutoLock.h" #include "nsAutoLock.h"
@ -117,10 +116,6 @@ nsP3PDataSchema::PostInit( nsString& aURISpec ) {
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsCOMPtr<nsIFileLocator> pFileLocator;
nsCOMPtr<nsIFileSpec> pFileSpec;
nsXPIDLCString xcsPath; nsXPIDLCString xcsPath;
@ -132,45 +127,50 @@ nsP3PDataSchema::PostInit( nsString& aURISpec ) {
PR_LOG_NOTICE, PR_LOG_NOTICE,
("P3PDataSchema: %s PostInit, attempting to redirect base DataSchema.\n", (const char *)mcsURISpec) ); ("P3PDataSchema: %s PostInit, attempting to redirect base DataSchema.\n", (const char *)mcsURISpec) );
// Create a file locator object // Find the components directory
pFileLocator = do_CreateInstance( NS_FILELOCATOR_CONTRACTID, nsCOMPtr<nsIFile> compsDir;
&rv ); rv = NS_GetSpecialDirectory(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(compsDir));
if (NS_SUCCEEDED( rv )) { if (NS_SUCCEEDED( rv )) {
// Find the components directory
rv = pFileLocator->GetFileLocation( nsSpecialFileSpec::App_ComponentsDirectory, // Create a URL of the components directory
getter_AddRefs( pFileSpec ) ); nsCOMPtr<nsIFileURL> compsDirURI(do_CreateInstance("@mozilla.org/network/standard-url;1", &rv));
if (NS_SUCCEEDED( rv )) { if (NS_SUCCEEDED( rv )) {
// Extract the path to the components directory rv = compsDirURI->SetFile(compsDir);
rv = pFileSpec->GetURLString( getter_Copies( xcsPath ) );
if (NS_SUCCEEDED( rv )) { if (NS_SUCCEEDED( rv )) {
// Make the local path the URI to be read rv = compsDirURI->GetSpec( getter_Copies( xcsPath ) );
mUseDOMParser = PR_TRUE;
mReadURISpec.AssignWithConversion((const char *)xcsPath ); if (NS_SUCCEEDED( rv )) {
mReadURISpec.AppendWithConversion( P3P_BASE_DATASCHEMA_LOCAL_NAME ); // Make the local path the URI to be read
mcsReadURISpec.AssignWithConversion( mReadURISpec ); mUseDOMParser = PR_TRUE;
PR_LOG( gP3PLogModule, mReadURISpec.AssignWithConversion((const char *)xcsPath );
PR_LOG_NOTICE, mReadURISpec.AppendWithConversion( P3P_BASE_DATASCHEMA_LOCAL_NAME );
("P3PDataSchema: %s PostInit, redirecting base DataSchema to %s.\n", (const char *)mcsURISpec, (const char *)mcsReadURISpec) ); mcsReadURISpec.AssignWithConversion( mReadURISpec );
PR_LOG( gP3PLogModule,
PR_LOG_NOTICE,
("P3PDataSchema: %s PostInit, redirecting base DataSchema to %s.\n", (const char *)mcsURISpec, (const char *)mcsReadURISpec) );
}
else {
PR_LOG( gP3PLogModule,
PR_LOG_ERROR,
("P3PDataSchema: %s PostInit, compsDirURI->GetSpec failed - %X, using remote base DataSchema.\n", (const char *)mcsURISpec, rv) );
}
} }
else { else {
PR_LOG( gP3PLogModule, PR_LOG( gP3PLogModule,
PR_LOG_ERROR, PR_LOG_ERROR,
("P3PDataSchema: %s PostInit, pFileSpec->GetURLString failed - %X, using remote base DataSchema.\n", (const char *)mcsURISpec, rv) ); ("P3PDataSchema: %s PostInit, compsDirURI->SetFile failed - %X, using remote base DataSchema.\n", (const char *)mcsURISpec, rv) );
} }
} }
else { else {
PR_LOG( gP3PLogModule, PR_LOG( gP3PLogModule,
PR_LOG_ERROR, PR_LOG_ERROR,
("P3PDataSchema: %s PostInit, pFileLocator->GetFileLocation failed - %X, using remote base DataSchema.\n", (const char *)mcsURISpec, rv) ); ("P3PDataSchema: %s PostInit, Creation of nsIFileURL failed - %X, using remote base DataSchema.\n", (const char *)mcsURISpec, rv) );
} }
} }
else { else {
PR_LOG( gP3PLogModule, PR_LOG( gP3PLogModule,
PR_LOG_ERROR, PR_LOG_ERROR,
("P3PDataSchema: %s PostInit, CreateInstance of pFileLocator failed - %X, using remote base DataSchema.\n", (const char *)mcsURISpec, rv) ); ("P3PDataSchema: %s PostInit, NS_GetSpecialDirectory failed - %X, using remote base DataSchema.\n", (const char *)mcsURISpec, rv) );
} }
// Don't fail if we can't obtain the "local" base DataSchema // Don't fail if we can't obtain the "local" base DataSchema

Просмотреть файл

@ -37,8 +37,6 @@
#include "nsIServiceManager.h" #include "nsIServiceManager.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
// //
#include "nsFileLocations.h"
#include "nsIFileLocator.h"
#include "nsIFileSpec.h" #include "nsIFileSpec.h"
#define TEST_URL "resource:/res/strres.properties" #define TEST_URL "resource:/res/strres.properties"

Просмотреть файл

@ -27,7 +27,6 @@
#include "nsMsgFilterService.h" #include "nsMsgFilterService.h"
#include "nsFileStream.h" #include "nsFileStream.h"
#include "nsMsgFilterList.h" #include "nsMsgFilterList.h"
#include "nsFileLocations.h"
#include "nsSpecialSystemDirectory.h" #include "nsSpecialSystemDirectory.h"
NS_IMPL_ISUPPORTS1(nsMsgFilterService, nsIMsgFilterService) NS_IMPL_ISUPPORTS1(nsMsgFilterService, nsIMsgFilterService)

Просмотреть файл

@ -24,7 +24,6 @@
#include "nsMsgBaseCID.h" #include "nsMsgBaseCID.h"
#include "nsMsgMailSession.h" #include "nsMsgMailSession.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsFileLocations.h"
#include "nsIMsgStatusFeedback.h" #include "nsIMsgStatusFeedback.h"
#include "nsIMsgWindow.h" #include "nsIMsgWindow.h"
#include "nsIMsgMessageService.h" #include "nsIMsgMessageService.h"

Просмотреть файл

@ -42,9 +42,9 @@
#include "nsParseMailbox.h" #include "nsParseMailbox.h"
#include "nsIFolder.h" #include "nsIFolder.h"
//#include "nsFileSpec.h"
#include "nsILocalFile.h" #include "nsILocalFile.h"
#include "nsFileStream.h" #include "nsFileStream.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIPref.h" #include "nsIPref.h"
@ -53,14 +53,10 @@
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#define PREF_MAIL_ROOT_MOVEMAIL "mail.root.movemail" #define PREF_MAIL_ROOT_MOVEMAIL "mail.root.movemail"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID); static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
nsMovemailService::nsMovemailService() nsMovemailService::nsMovemailService()
{ {
@ -539,20 +535,50 @@ nsMovemailService::SetDefaultLocalPath(nsIFileSpec *aPath)
NS_IMETHODIMP NS_IMETHODIMP
nsMovemailService::GetDefaultLocalPath(nsIFileSpec ** aResult) nsMovemailService::GetDefaultLocalPath(nsIFileSpec ** aResult)
{ {
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
nsresult rv; nsresult rv;
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv); NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = prefs->GetFilePref(PREF_MAIL_ROOT_MOVEMAIL, aResult); PRBool havePref = PR_FALSE;
if (NS_SUCCEEDED(rv)) return rv; nsCOMPtr<nsILocalFile> prefLocal;
nsCOMPtr<nsIFile> localFile;
NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); rv = prefs->GetFileXPref(PREF_MAIL_ROOT_MOVEMAIL, getter_AddRefs(prefLocal));
if (NS_SUCCEEDED(rv)) {
localFile = prefLocal;
havePref = PR_TRUE;
}
if (!localFile) {
rv = NS_GetSpecialDirectory(NS_APP_MAIL_50_DIR, getter_AddRefs(localFile));
if (NS_FAILED(rv)) return rv;
havePref = PR_FALSE;
}
PRBool exists;
rv = localFile->Exists(&exists);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
if (!exists) {
rv = locator->GetFileLocation(nsSpecialFileSpec::App_MailDirectory50, aResult); rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0775);
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
}
rv = SetDefaultLocalPath(*aResult);
// Make the resulting nsIFileSpec
// TODO: Convert arg to nsILocalFile and avoid this
nsXPIDLCString pathBuf;
rv = localFile->GetPath(getter_Copies(pathBuf));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIFileSpec> outSpec;
rv = NS_NewFileSpec(getter_AddRefs(outSpec));
if (NS_FAILED(rv)) return rv;
outSpec->SetNativePath(pathBuf);
if (!havePref || !exists)
rv = SetDefaultLocalPath(outSpec);
*aResult = outSpec;
NS_IF_ADDREF(*aResult);
return rv; return rv;
} }

Просмотреть файл

@ -32,7 +32,6 @@
#include "nsIFileTransportService.h" #include "nsIFileTransportService.h"
#include "nsIInputStream.h" #include "nsIInputStream.h"
#include "nsIOutputStream.h" #include "nsIOutputStream.h"
#include "nsFileLocations.h"
#include "nsILocalFile.h" #include "nsILocalFile.h"
#include "nsMimeTypes.h" #include "nsMimeTypes.h"

Просмотреть файл

@ -43,8 +43,6 @@
#include "plstr.h" #include "plstr.h"
#include "prprf.h" #include "prprf.h"
#include "nsXPIDLString.h" #include "nsXPIDLString.h"
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#include "nsIStringBundle.h" #include "nsIStringBundle.h"
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
#include "nsProxiedService.h" #include "nsProxiedService.h"
@ -221,7 +219,6 @@ typedef struct
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID ); static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID );
static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID);
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
static NS_DEFINE_IID(kIPrefMigrationIID, NS_IPREFMIGRATION_IID); static NS_DEFINE_IID(kIPrefMigrationIID, NS_IPREFMIGRATION_IID);
static NS_DEFINE_IID(kPrefMigrationCID, NS_PREFMIGRATION_CID); static NS_DEFINE_IID(kPrefMigrationCID, NS_PREFMIGRATION_CID);
@ -229,7 +226,6 @@ static NS_DEFINE_IID(kPrefMigrationCID, NS_PREFMIGRATION_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);

Просмотреть файл

@ -5,7 +5,6 @@
nsAppleEvents.h nsAppleEvents.h
nsAppShellCIDs.h nsAppShellCIDs.h
nsIWebShellWindow.h nsIWebShellWindow.h
nsFileLocations.h
nsIDOMXPConnectFactory.h nsIDOMXPConnectFactory.h
nsINetSupportDialogService.h nsINetSupportDialogService.h
nsISplashScreen.h nsISplashScreen.h

Просмотреть файл

@ -4,7 +4,6 @@
nsIAppShellService.idl nsIAppShellService.idl
nsICmdLineService.idl nsICmdLineService.idl
nsIFileLocator.idl
nsIWindowMediator.idl nsIWindowMediator.idl
nsIXULWindow.idl nsIXULWindow.idl
nsIUserInfo.idl nsIUserInfo.idl

Просмотреть файл

@ -32,7 +32,6 @@ XPIDL_MODULE = appshell
EXPORTS = \ EXPORTS = \
nsIWebShellWindow.h \ nsIWebShellWindow.h \
nsAppShellCIDs.h \ nsAppShellCIDs.h \
nsFileLocations.h \
nsIDOMXPConnectFactory.h \ nsIDOMXPConnectFactory.h \
nsISplashScreen.h \ nsISplashScreen.h \
nsINativeAppSupport.h \ nsINativeAppSupport.h \
@ -42,7 +41,6 @@ XPIDLSRCS = \
nsIAppShellService.idl \ nsIAppShellService.idl \
nsICmdLineService.idl \ nsICmdLineService.idl \
nsICmdLineHandler.idl \ nsICmdLineHandler.idl \
nsIFileLocator.idl \
nsIWindowMediator.idl \ nsIWindowMediator.idl \
nsIXULWindow.idl \ nsIXULWindow.idl \
nsIUserInfo.idl \ nsIUserInfo.idl \

Просмотреть файл

@ -29,7 +29,6 @@ XPIDLSRCS = \
.\nsIAppShellService.idl \ .\nsIAppShellService.idl \
.\nsICmdLineService.idl \ .\nsICmdLineService.idl \
.\nsICmdLineHandler.idl \ .\nsICmdLineHandler.idl \
.\nsIFileLocator.idl \
.\nsIWindowMediator.idl \ .\nsIWindowMediator.idl \
.\nsIXULWindow.idl \ .\nsIXULWindow.idl \
.\nsIUserInfo.idl \ .\nsIUserInfo.idl \
@ -39,7 +38,6 @@ XPIDLSRCS = \
EXPORTS = \ EXPORTS = \
nsIWebShellWindow.h \ nsIWebShellWindow.h \
nsAppShellCIDs.h \ nsAppShellCIDs.h \
nsFileLocations.h \
nsISplashScreen.h \ nsISplashScreen.h \
nsINativeAppSupport.h \ nsINativeAppSupport.h \
$(NULL) $(NULL)

Просмотреть файл

@ -40,7 +40,6 @@ CPPSRCS = \
nsAppShellService.cpp \ nsAppShellService.cpp \
nsWebShellWindow.cpp \ nsWebShellWindow.cpp \
nsCommandLineService.cpp \ nsCommandLineService.cpp \
nsFileLocations.cpp \
nsWindowMediator.cpp \ nsWindowMediator.cpp \
nsAbout.cpp \ nsAbout.cpp \
nsAppShellFactory.cpp \ nsAppShellFactory.cpp \

Просмотреть файл

@ -35,7 +35,6 @@ CPP_OBJS= \
.\$(OBJDIR)\nsWebShellWindow.obj \ .\$(OBJDIR)\nsWebShellWindow.obj \
.\$(OBJDIR)\nsAppShellFactory.obj \ .\$(OBJDIR)\nsAppShellFactory.obj \
.\$(OBJDIR)\nsCommandLineService.obj \ .\$(OBJDIR)\nsCommandLineService.obj \
.\$(OBJDIR)\nsFileLocations.obj \
.\$(OBJDIR)\nsWindowMediator.obj \ .\$(OBJDIR)\nsWindowMediator.obj \
.\$(OBJDIR)\nsAbout.obj \ .\$(OBJDIR)\nsAbout.obj \
.\$(OBJDIR)\nsUserInfoWin.obj \ .\$(OBJDIR)\nsUserInfoWin.obj \

Просмотреть файл

@ -25,7 +25,6 @@
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsAppShellCIDs.h" #include "nsAppShellCIDs.h"
#include "nsICmdLineService.h" #include "nsICmdLineService.h"
#include "nsIFileLocator.h"
#include "nsIWindowMediator.h" #include "nsIWindowMediator.h"
#include "rdf.h" #include "rdf.h"
#include "nsAbout.h" #include "nsAbout.h"
@ -36,7 +35,6 @@
#include "nsCommandLineService.h" #include "nsCommandLineService.h"
#include "nsAppShellService.h" #include "nsAppShellService.h"
#include "nsWindowMediator.h" #include "nsWindowMediator.h"
#include "nsFileLocations.h"
#include "nsTimingService.h" #include "nsTimingService.h"
#ifdef XP_MAC #ifdef XP_MAC
@ -54,7 +52,6 @@ nsresult NS_NewAppShellServiceFactory(nsIFactory** aFactory);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCmdLineService); NS_GENERIC_FACTORY_CONSTRUCTOR(nsCmdLineService);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShellService); NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShellService);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowMediator); NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowMediator);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFileLocator);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUserInfo); NS_GENERIC_FACTORY_CONSTRUCTOR(nsUserInfo);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimingService); NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimingService);
@ -80,11 +77,6 @@ static nsModuleComponentInfo gAppShellModuleInfo[] =
NS_ABOUT_MODULE_CONTRACTID_PREFIX, NS_ABOUT_MODULE_CONTRACTID_PREFIX,
nsAbout::Create, nsAbout::Create,
}, },
{ "File Locator Service",
NS_FILELOCATOR_CID,
NS_FILELOCATOR_CONTRACTID,
nsFileLocatorConstructor,
},
{ "User Info Service", { "User Info Service",
NS_USERINFO_CID, NS_USERINFO_CID,
NS_USERINFO_CONTRACTID, NS_USERINFO_CONTRACTID,

Просмотреть файл

@ -92,7 +92,6 @@
#include "nsIDocumentLoader.h" #include "nsIDocumentLoader.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsFileLocations.h"
#include "nsIFileSpec.h" #include "nsIFileSpec.h"