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 "nsIProperties.h"
#include "nsIFile.h"
#include "nsStdURL.h"
#include "nsNetUtil.h"
#include "nsXPIDLString.h"
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#include "nsIFileSpec.h"
#include "nsAutoLock.h"
@ -117,10 +116,6 @@ nsP3PDataSchema::PostInit( nsString& aURISpec ) {
nsresult rv = NS_OK;
nsCOMPtr<nsIFileLocator> pFileLocator;
nsCOMPtr<nsIFileSpec> pFileSpec;
nsXPIDLCString xcsPath;
@ -132,18 +127,17 @@ nsP3PDataSchema::PostInit( nsString& aURISpec ) {
PR_LOG_NOTICE,
("P3PDataSchema: %s PostInit, attempting to redirect base DataSchema.\n", (const char *)mcsURISpec) );
// Create a file locator object
pFileLocator = do_CreateInstance( NS_FILELOCATOR_CONTRACTID,
&rv );
if (NS_SUCCEEDED( rv )) {
// Find the components directory
rv = pFileLocator->GetFileLocation( nsSpecialFileSpec::App_ComponentsDirectory,
getter_AddRefs( pFileSpec ) );
nsCOMPtr<nsIFile> compsDir;
rv = NS_GetSpecialDirectory(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(compsDir));
if (NS_SUCCEEDED( rv )) {
// Extract the path to the components directory
rv = pFileSpec->GetURLString( getter_Copies( xcsPath ) );
// Create a URL of the components directory
nsCOMPtr<nsIFileURL> compsDirURI(do_CreateInstance("@mozilla.org/network/standard-url;1", &rv));
if (NS_SUCCEEDED( rv )) {
rv = compsDirURI->SetFile(compsDir);
if (NS_SUCCEEDED( rv )) {
rv = compsDirURI->GetSpec( getter_Copies( xcsPath ) );
if (NS_SUCCEEDED( rv )) {
// Make the local path the URI to be read
@ -158,19 +152,25 @@ nsP3PDataSchema::PostInit( nsString& aURISpec ) {
else {
PR_LOG( gP3PLogModule,
PR_LOG_ERROR,
("P3PDataSchema: %s PostInit, pFileSpec->GetURLString failed - %X, using remote base DataSchema.\n", (const char *)mcsURISpec, rv) );
("P3PDataSchema: %s PostInit, compsDirURI->GetSpec failed - %X, using remote base DataSchema.\n", (const char *)mcsURISpec, rv) );
}
}
else {
PR_LOG( gP3PLogModule,
PR_LOG_ERROR,
("P3PDataSchema: %s PostInit, pFileLocator->GetFileLocation 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 {
PR_LOG( gP3PLogModule,
PR_LOG_ERROR,
("P3PDataSchema: %s PostInit, CreateInstance of pFileLocator 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 {
PR_LOG( gP3PLogModule,
PR_LOG_ERROR,
("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

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

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

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

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

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

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

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

@ -42,9 +42,9 @@
#include "nsParseMailbox.h"
#include "nsIFolder.h"
//#include "nsFileSpec.h"
#include "nsILocalFile.h"
#include "nsFileStream.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIPref.h"
@ -53,14 +53,10 @@
#include "nsXPIDLString.h"
#include "nsCOMPtr.h"
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#define PREF_MAIL_ROOT_MOVEMAIL "mail.root.movemail"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID);
nsMovemailService::nsMovemailService()
{
@ -539,20 +535,50 @@ nsMovemailService::SetDefaultLocalPath(nsIFileSpec *aPath)
NS_IMETHODIMP
nsMovemailService::GetDefaultLocalPath(nsIFileSpec ** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
nsresult rv;
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = prefs->GetFilePref(PREF_MAIL_ROOT_MOVEMAIL, aResult);
if (NS_SUCCEEDED(rv)) return rv;
NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv);
PRBool havePref = PR_FALSE;
nsCOMPtr<nsILocalFile> prefLocal;
nsCOMPtr<nsIFile> localFile;
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;
}
rv = locator->GetFileLocation(nsSpecialFileSpec::App_MailDirectory50, aResult);
PRBool exists;
rv = localFile->Exists(&exists);
if (NS_FAILED(rv)) return rv;
if (!exists) {
rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0775);
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;
}

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

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

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

@ -43,8 +43,6 @@
#include "plstr.h"
#include "prprf.h"
#include "nsXPIDLString.h"
#include "nsIFileLocator.h"
#include "nsFileLocations.h"
#include "nsIStringBundle.h"
#include "nsISupportsPrimitives.h"
#include "nsProxiedService.h"
@ -221,7 +219,6 @@ typedef struct
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
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(kIPrefMigrationIID, NS_IPREFMIGRATION_IID);
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(kComponentManagerCID, NS_COMPONENTMANAGER_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(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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