From d9e8edcf2931ec6995c42179f48d2951de5aa7d2 Mon Sep 17 00:00:00 2001 From: "conrad%ingress.com" Date: Fri, 11 Aug 2000 20:31:57 +0000 Subject: [PATCH] Changed from using strings for nsIDirectoryService props to using macro names defined in nsDirectoryServiceDefs.h r=valeski --- .../tools/src/nsXPCToolsCompiler.cpp | 3 +- modules/libjar/nsJARChannel.cpp | 3 +- modules/libreg/xpcom/nsRegistry.cpp | 3 +- netwerk/protocol/about/src/nsAboutBloat.cpp | 3 +- netwerk/protocol/jar/src/nsJARChannel.cpp | 3 +- .../protocol/res/src/nsResProtocolHandler.cpp | 25 ++++---- .../exthandler/nsExternalHelperAppService.cpp | 5 +- xpcom/build/nsXPComInit.cpp | 3 +- xpcom/components/nsComponentManager.cpp | 9 +-- xpcom/components/nsRegistry.cpp | 3 +- .../xptinfo/src/xptiInterfaceInfoManager.cpp | 3 +- xpinstall/src/nsInstall.cpp | 3 +- xpinstall/src/nsInstallFolder.cpp | 57 +++++++++++-------- xpinstall/src/nsLoggingProgressNotifier.cpp | 3 +- xpinstall/src/nsRegisterItem.cpp | 3 +- xpinstall/src/nsSoftwareUpdate.cpp | 3 +- xpinstall/src/nsXPInstallManager.cpp | 3 +- 17 files changed, 79 insertions(+), 56 deletions(-) diff --git a/js/src/xpconnect/tools/src/nsXPCToolsCompiler.cpp b/js/src/xpconnect/tools/src/nsXPCToolsCompiler.cpp index 644826f07d36..024e6b63eae1 100644 --- a/js/src/xpconnect/tools/src/nsXPCToolsCompiler.cpp +++ b/js/src/xpconnect/tools/src/nsXPCToolsCompiler.cpp @@ -36,6 +36,7 @@ /* Implements nsXPCToolsCompiler. */ #include "xpctools_private.h" +#include "nsDirectoryServiceDefs.h" NS_IMPL_ISUPPORTS1(nsXPCToolsCompiler, nsIXPCToolsCompiler) @@ -54,7 +55,7 @@ NS_IMETHODIMP nsXPCToolsCompiler::GetBinDir(nsILocalFile * *aBinDir) *aBinDir = nsnull; nsCOMPtr file; - nsresult rv = NS_GetSpecialDirectory("xpcom.currentProcessDirectory", getter_AddRefs(file)); + nsresult rv = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR, getter_AddRefs(file)); if(NS_FAILED(rv)) return rv; diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp index 5db30a99d944..2bf047f43da6 100644 --- a/modules/libjar/nsJARChannel.cpp +++ b/modules/libjar/nsJARChannel.cpp @@ -32,6 +32,7 @@ #include "nsScriptSecurityManager.h" #include "nsIAggregatePrincipal.h" #include "nsXPIDLString.h" +#include "nsDirectoryServiceDefs.h" #ifdef NS_USE_CACHE_MANAGER_FOR_JAR #include "nsINetDataCacheManager.h" @@ -539,7 +540,7 @@ nsJARChannel::GetCacheFile(nsIFile* *cacheFile) nsresult rv; nsCOMPtr jarCacheFile; - rv = NS_GetSpecialDirectory("xpcom.currentProcess.componentDirectory", + rv = NS_GetSpecialDirectory(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(jarCacheFile)); if (NS_FAILED(rv)) return rv; diff --git a/modules/libreg/xpcom/nsRegistry.cpp b/modules/libreg/xpcom/nsRegistry.cpp index 0354f2e83903..11ad5edb050d 100644 --- a/modules/libreg/xpcom/nsRegistry.cpp +++ b/modules/libreg/xpcom/nsRegistry.cpp @@ -23,6 +23,7 @@ #include "nsIRegistry.h" #include "nsIEnumerator.h" #include "nsDirectoryService.h" +#include "nsDirectoryServiceDefs.h" #include "NSReg.h" #include "prmem.h" #include "prlock.h" @@ -444,7 +445,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) { NS_GET_IID(nsIProperties), getter_AddRefs(directoryService)); if (NS_FAILED(rv)) return rv; - directoryService->Get("xpcom.currentProcess.componentRegistry", NS_GET_IID(nsIFile), + directoryService->Get(NS_XPCOM_COMPONENT_REGISTRY_FILE, NS_GET_IID(nsIFile), getter_AddRefs(registryLocation)); if (registryLocation) diff --git a/netwerk/protocol/about/src/nsAboutBloat.cpp b/netwerk/protocol/about/src/nsAboutBloat.cpp index 468b108b2cc2..9bd2f8d9ab9d 100644 --- a/netwerk/protocol/about/src/nsAboutBloat.cpp +++ b/netwerk/protocol/about/src/nsAboutBloat.cpp @@ -30,6 +30,7 @@ #include "nsCOMPtr.h" #include "nsIFileStreams.h" #include "nsNetUtil.h" +#include "nsDirectoryServiceDefs.h" #ifdef XP_MAC extern "C" void GC_gcollect(void); @@ -97,7 +98,7 @@ nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result) } else { nsCOMPtr file; - rv = NS_GetSpecialDirectory("xpcom.currentProcess.componentDirectory", + rv = NS_GetSpecialDirectory(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(file)); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/protocol/jar/src/nsJARChannel.cpp b/netwerk/protocol/jar/src/nsJARChannel.cpp index 5db30a99d944..2bf047f43da6 100644 --- a/netwerk/protocol/jar/src/nsJARChannel.cpp +++ b/netwerk/protocol/jar/src/nsJARChannel.cpp @@ -32,6 +32,7 @@ #include "nsScriptSecurityManager.h" #include "nsIAggregatePrincipal.h" #include "nsXPIDLString.h" +#include "nsDirectoryServiceDefs.h" #ifdef NS_USE_CACHE_MANAGER_FOR_JAR #include "nsINetDataCacheManager.h" @@ -539,7 +540,7 @@ nsJARChannel::GetCacheFile(nsIFile* *cacheFile) nsresult rv; nsCOMPtr jarCacheFile; - rv = NS_GetSpecialDirectory("xpcom.currentProcess.componentDirectory", + rv = NS_GetSpecialDirectory(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(jarCacheFile)); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/protocol/res/src/nsResProtocolHandler.cpp b/netwerk/protocol/res/src/nsResProtocolHandler.cpp index fdf9ce6ba382..1bd717d7c7cb 100644 --- a/netwerk/protocol/res/src/nsResProtocolHandler.cpp +++ b/netwerk/protocol/res/src/nsResProtocolHandler.cpp @@ -45,6 +45,7 @@ #include "prprf.h" #include "nsXPIDLString.h" #include "nsIFile.h" +#include "nsDirectoryServiceDefs.h" static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID); static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); @@ -91,36 +92,36 @@ nsResProtocolHandler::Init() return NS_ERROR_OUT_OF_MEMORY; // set up initial mappings - rv = SetSpecialDir("ProgramDir", "system.OS_CurrentProcessDirectory"); + rv = SetSpecialDir("ProgramDir", NS_OS_CURRENT_PROCESS_DIR); if (NS_FAILED(rv)) return rv; // make "res:///" == "resource:/" - rv = SetSpecialDir("", "xpcom.currentProcess"); + rv = SetSpecialDir("", NS_XPCOM_CURRENT_PROCESS_DIR); if (NS_FAILED(rv)) return rv; - rv = SetSpecialDir("CurrentDir", "system.OS_CurrentWorkingDirectory"); + rv = SetSpecialDir("CurrentDir", NS_OS_CURRENT_WORKING_DIR); if (NS_FAILED(rv)) return rv; - rv = SetSpecialDir("CurrentDrive", "system.OS_DriveDirectory"); + rv = SetSpecialDir("CurrentDrive", NS_OS_DRIVE_DIR); if (NS_FAILED(rv)) return rv; - rv = SetSpecialDir("TempDir", "system.OS_TemporaryDirectory"); + rv = SetSpecialDir("TempDir", NS_OS_TEMP_DIR); if (NS_FAILED(rv)) return rv; - rv = SetSpecialDir("ComponentsDir", "xpcom.currentProcess.componentDirectory"); + rv = SetSpecialDir("ComponentsDir", NS_XPCOM_COMPONENT_DIR); if (NS_FAILED(rv)) return rv; rv = SetSpecialDir("SystemDir", #ifdef XP_MAC - "system.SystemDirectory" + NS_OS_SYSTEM_DIR #elif XP_OS2 - "system.SystemDirectory" + NS_OS_SYSTEM_DIR #elif XP_PC - "system.SystemDirectory" + NS_OS_SYSTEM_DIR #elif XP_BEOS - "system.SystemDirectory" + NS_OS_SYSTEM_DIR #else - "system.LibDirectory" // XXX ??? + NS_UNIX_LIB_DIR // XXX ??? #endif ); if (NS_FAILED(rv)) return rv; @@ -128,7 +129,7 @@ nsResProtocolHandler::Init() // Set up the "Resource" root to point to the old resource location // such that: // resource:// == res://Resource/ - rv = SetSpecialDir("Resource", "xpcom.currentProcess"); + rv = SetSpecialDir("Resource", NS_XPCOM_CURRENT_PROCESS_DIR); if (NS_FAILED(rv)) return rv; return rv; diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index ec69b0d58d61..eecfe68f5c6c 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -40,6 +40,7 @@ #include "nsFileLocations.h" #include "nsHelperAppRDF.h" #include "nsIMIMEInfo.h" +#include "nsDirectoryServiceDefs.h" #include "nsIHelperAppLauncherDialog.h" #include "nsIFilePicker.h" @@ -410,10 +411,10 @@ nsresult nsExternalAppHandler::SetUpTempFile(nsIChannel * aChannel) #ifdef XP_MAC // create a temp file for the data...and open it for writing. - NS_GetSpecialDirectory("system.DesktopDirectory", getter_AddRefs(mTempFile)); + NS_GetSpecialDirectory(NS_MAC_DESKTOP_DIR, getter_AddRefs(mTempFile)); #else // create a temp file for the data...and open it for writing. - NS_GetSpecialDirectory("system.OS_TemporaryDirectory", getter_AddRefs(mTempFile)); + NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(mTempFile)); #endif nsCOMPtr uri; diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp index 67151ef7146b..008c9f247a97 100644 --- a/xpcom/build/nsXPComInit.cpp +++ b/xpcom/build/nsXPComInit.cpp @@ -63,6 +63,7 @@ #include "nsILocalFile.h" #include "nsLocalFile.h" #include "nsDirectoryService.h" +#include "nsDirectoryServiceDefs.h" #include "nsICategoryManager.h" #include "nsAtomService.h" @@ -241,7 +242,7 @@ nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result, rv = binDirectory->IsDirectory(&value); if (NS_SUCCEEDED(rv) && value) - gDirectoryService->Define("xpcom.currentProcessDirectory", binDirectory); + gDirectoryService->Define(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory); //Since people are still using the nsSpecialSystemDirectory, we should init it. char* path; diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index dbaea9ef112c..35f303c0cddb 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -58,6 +58,7 @@ #include "nsILocalFile.h" #include "nsLocalFile.h" #include "nsDirectoryService.h" +#include "nsDirectoryServiceDefs.h" #include "plstr.h" #include "prlink.h" @@ -493,7 +494,7 @@ nsComponentManagerImpl::PlatformInit(void) NS_GET_IID(nsIProperties), getter_AddRefs(directoryService)); - directoryService->Get("xpcom.currentProcess.componentDirectory", NS_GET_IID(nsIFile), getter_AddRefs(mComponentsDir)); + directoryService->Get(NS_XPCOM_COMPONENT_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mComponentsDir)); if (!mComponentsDir) return NS_ERROR_OUT_OF_MEMORY; @@ -1998,8 +1999,8 @@ nsComponentManagerImpl::AutoRegister(PRInt32 when, nsIFile *inDirSpec) if (NS_FAILED(rv)) return rv; // Don't care if undefining fails - directoryService->Undefine("xpcom.currentProcess.componentDirectory"); - rv = directoryService->Define("xpcom.currentProcess.componentDirectory", dir); + directoryService->Undefine(NS_XPCOM_COMPONENT_DIR); + rv = directoryService->Define(NS_XPCOM_COMPONENT_DIR, dir); if (NS_FAILED(rv)) return rv; } else @@ -2008,7 +2009,7 @@ nsComponentManagerImpl::AutoRegister(PRInt32 when, nsIFile *inDirSpec) NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (NS_FAILED(rv)) return rv; - rv = directoryService->Get("xpcom.currentProcess.componentDirectory", NS_GET_IID(nsIFile), getter_AddRefs(dir)); + rv = directoryService->Get(NS_XPCOM_COMPONENT_DIR, NS_GET_IID(nsIFile), getter_AddRefs(dir)); if (NS_FAILED(rv)) return rv; // XXX translate error code? } diff --git a/xpcom/components/nsRegistry.cpp b/xpcom/components/nsRegistry.cpp index 0354f2e83903..11ad5edb050d 100644 --- a/xpcom/components/nsRegistry.cpp +++ b/xpcom/components/nsRegistry.cpp @@ -23,6 +23,7 @@ #include "nsIRegistry.h" #include "nsIEnumerator.h" #include "nsDirectoryService.h" +#include "nsDirectoryServiceDefs.h" #include "NSReg.h" #include "prmem.h" #include "prlock.h" @@ -444,7 +445,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) { NS_GET_IID(nsIProperties), getter_AddRefs(directoryService)); if (NS_FAILED(rv)) return rv; - directoryService->Get("xpcom.currentProcess.componentRegistry", NS_GET_IID(nsIFile), + directoryService->Get(NS_XPCOM_COMPONENT_REGISTRY_FILE, NS_GET_IID(nsIFile), getter_AddRefs(registryLocation)); if (registryLocation) diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp index 9e642c6503b8..0bdf763f7332 100644 --- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp +++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp @@ -23,6 +23,7 @@ /* Implementation of xptiInterfaceInfoManager. */ #include "xptiprivate.h" +#include "nsDirectoryServiceDefs.h" NS_IMPL_THREADSAFE_ISUPPORTS1(xptiInterfaceInfoManager, nsIInterfaceInfoManager) @@ -158,7 +159,7 @@ xptiInterfaceInfoManager::GetComponentsDir(nsILocalFile** aDir) if(dirService) { nsCOMPtr dir; - dirService->Get("xpcom.currentProcess.componentDirectory", + dirService->Get(NS_XPCOM_COMPONENT_DIR, NS_GET_IID(nsIFile), getter_AddRefs(dir)); if(dir) { diff --git a/xpinstall/src/nsInstall.cpp b/xpinstall/src/nsInstall.cpp index 2e25574e9cc5..0d8468222c2c 100644 --- a/xpinstall/src/nsInstall.cpp +++ b/xpinstall/src/nsInstall.cpp @@ -38,6 +38,7 @@ #include "nsFileStream.h" #include "nsSpecialSystemDirectory.h" #include "nsDirectoryService.h" +#include "nsDirectoryServiceDefs.h" #include "nsIPref.h" @@ -2436,7 +2437,7 @@ nsInstall::ExtractFileFromJar(const nsString& aJarfile, nsIFile* aSuggestedName, { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); - directoryService->Get("system.OS_TemporaryDirectory", NS_GET_IID(nsIFile), getter_AddRefs(tempFile)); + directoryService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(tempFile)); nsString tempFileName; tempFileName.AssignWithConversion("xpinstall"); diff --git a/xpinstall/src/nsInstallFolder.cpp b/xpinstall/src/nsInstallFolder.cpp index 100a21e24f8c..568c74827b68 100644 --- a/xpinstall/src/nsInstallFolder.cpp +++ b/xpinstall/src/nsInstallFolder.cpp @@ -38,6 +38,8 @@ #include "nsILocalFile.h" #include "nsDirectoryService.h" #include "nsSpecialSystemDirectory.h" +#include "nsDirectoryServiceDefs.h" +#include "nsAppDirectoryServiceDefs.h" #include "nsFileLocations.h" #include "nsIFileLocator.h" @@ -173,7 +175,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.OS_CurrentProcessDirectory", NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); + directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); #ifdef XP_MAC mFileSpec->Append("Plugins"); #else @@ -203,7 +205,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.OS_CurrentProcessDirectory", NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); + directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } else //In stub installer. mProgram has been set so { @@ -216,7 +218,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.OS_TemporaryDirectory", NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); + directoryService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } break; @@ -225,7 +227,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("app.profile.user.directory.5", NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); + directoryService->Get(NS_APP_USER_PROFILE_50_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } break; @@ -233,7 +235,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("app.prefs.directory.5", NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); + directoryService->Get(NS_APP_PREFS_50_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } break; @@ -241,7 +243,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.OS_DriveDirectory", NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); + directoryService->Get(NS_OS_DRIVE_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } break; @@ -277,7 +279,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.OS_CurrentProcessDirectory", + directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); @@ -312,7 +314,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.OS_CurrentProcessDirectory", + directoryService->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); @@ -341,11 +343,12 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe } break; +#ifdef XP_PC case 200: /////////////////////////////////////////////////////////// Win System { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.SystemDirectory", + directoryService->Get(NS_OS_SYSTEM_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); @@ -356,17 +359,19 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.WindowsDirectory", + directoryService->Get(NS_WIN_WINDOWS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } break; +#endif +#ifdef XP_MAC case 300: /////////////////////////////////////////////////////////// Mac System { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.Directory", + directoryService->Get(NS_OS_SYSTEM_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -376,7 +381,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.DesktopDirectory", + directoryService->Get(NS_MAC_DESKTOP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -386,7 +391,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.TrashDirectory", + directoryService->Get(NS_MAC_TRASH_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -396,7 +401,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.StartupDirectory", + directoryService->Get(NS_MAC_STARTUP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -406,7 +411,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.ShutdownDirectory", + directoryService->Get(NS_MAC_SHUTDOWN_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -416,7 +421,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.AppleMenuDirectory", + directoryService->Get(NS_MAC_APPLE_MENU_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -426,7 +431,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.ControlPanelDirectory", + directoryService->Get(NS_MAC_CONTROL_PANELS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -436,7 +441,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.ExtensionDirectory", + directoryService->Get(NS_MAC_EXTENSIONS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -446,7 +451,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.FontsDirectory", + directoryService->Get(NS_MAC_FONTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -456,7 +461,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.PreferencesDirectory", + directoryService->Get(NS_MAC_PREFS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -466,17 +471,19 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.DocumentsDirectory", + directoryService->Get(NS_MAC_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } break; - +#endif + +#ifdef XP_UNIX case 400: /////////////////////////////////////////////////////////// Unix Local { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.LocalDirectory", + directoryService->Get(NS_UNIX_LOCAL_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } @@ -486,12 +493,12 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe { NS_WITH_SERVICE(nsIProperties, directoryService, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!directoryService) return; - directoryService->Get("system.LibDirectory", + directoryService->Get(NS_UNIX_LIB_DIR, NS_GET_IID(nsIFile), getter_AddRefs(mFileSpec)); } break; - +#endif case -1: default: diff --git a/xpinstall/src/nsLoggingProgressNotifier.cpp b/xpinstall/src/nsLoggingProgressNotifier.cpp index 72712b94be8e..7d981e2b4098 100644 --- a/xpinstall/src/nsLoggingProgressNotifier.cpp +++ b/xpinstall/src/nsLoggingProgressNotifier.cpp @@ -31,6 +31,7 @@ #include "nsFileSpec.h" #include "nsFileStream.h" #include "nsDirectoryService.h" +#include "nsDirectoryServiceDefs.h" #include "nspr.h" @@ -68,7 +69,7 @@ nsLoggingProgressListener::BeforeJavascriptEvaluation(const PRUnichar *URL) NS_WITH_SERVICE(nsIProperties, dirSvc, NS_DIRECTORY_SERVICE_PROGID, &rv); if (!dirSvc) return NS_ERROR_FAILURE; - dirSvc->Get("system.OS_CurrentProcessDirectory", NS_GET_IID(nsIFile), + dirSvc->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(iFile)); } // In stub installer diff --git a/xpinstall/src/nsRegisterItem.cpp b/xpinstall/src/nsRegisterItem.cpp index 633c4deb33de..0b5aab15759f 100644 --- a/xpinstall/src/nsRegisterItem.cpp +++ b/xpinstall/src/nsRegisterItem.cpp @@ -30,6 +30,7 @@ #include "nsInstallTrigger.h" #include "nsIChromeRegistry.h" #include "nsIDirectoryService.h" +#include "nsDirectoryServiceDefs.h" MOZ_DECL_CTOR_COUNTER(nsRegisterItem); @@ -132,7 +133,7 @@ PRInt32 nsRegisterItem::Complete() NS_DIRECTORY_SERVICE_PROGID, &rv); if(NS_SUCCEEDED(rv) && directoryService) { - directoryService->Get("xpcom.currentProcess", + directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(progDir)); } } diff --git a/xpinstall/src/nsSoftwareUpdate.cpp b/xpinstall/src/nsSoftwareUpdate.cpp index ca7853b57986..b01c687c0685 100644 --- a/xpinstall/src/nsSoftwareUpdate.cpp +++ b/xpinstall/src/nsSoftwareUpdate.cpp @@ -38,6 +38,7 @@ #include "NSReg.h" #include "VerReg.h" #include "nsIDirectoryService.h" +#include "nsDirectoryServiceDefs.h" #include "nsInstall.h" #include "nsSoftwareUpdateIIDs.h" @@ -144,7 +145,7 @@ nsSoftwareUpdate::nsSoftwareUpdate() if(!directoryService) return; nsCOMPtr dir; - directoryService->Get("xpcom.currentProcess", NS_GET_IID(nsIFile), getter_AddRefs(dir)); + directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(dir)); if (dir) { char* nativePath; diff --git a/xpinstall/src/nsXPInstallManager.cpp b/xpinstall/src/nsXPInstallManager.cpp index f422bfda5480..1653b4bf16d3 100644 --- a/xpinstall/src/nsXPInstallManager.cpp +++ b/xpinstall/src/nsXPInstallManager.cpp @@ -53,6 +53,7 @@ #include "nsIProxyObjectManager.h" #include "nsIDOMWindow.h" #include "nsDirectoryService.h" +#include "nsDirectoryServiceDefs.h" #include "nsFileLocations.h" #include "nsProxiedService.h" @@ -621,7 +622,7 @@ nsXPInstallManager::GetDestinationFile(nsString& url, nsILocalFile* *file) if (NS_SUCCEEDED(rv)) { nsCOMPtr temp; - directoryService->Get("system.OS_TemporaryDirectory", + directoryService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(temp)); temp->AppendUnicode(leaf.GetUnicode());