diff --git a/mozilla/extensions/cookie/nsCookie.cpp b/mozilla/extensions/cookie/nsCookie.cpp index da840d13311..2aa7a8a5786 100644 --- a/mozilla/extensions/cookie/nsCookie.cpp +++ b/mozilla/extensions/cookie/nsCookie.cpp @@ -32,6 +32,7 @@ #include "nsIServiceManager.h" #include "nsFileStream.h" #include "nsIFileLocator.h" +#include "nsIFileSpec.h" #include "nsFileLocations.h" extern "C" { @@ -198,20 +199,11 @@ cookie_Localize(char* genericString) { } PRIVATE nsresult cookie_ProfileDirectory(nsFileSpec& dirSpec) { - nsresult rv; - nsIFileLocator* locator = nsnull; - rv = nsServiceManager::GetService - (kFileLocatorCID, kIFileLocatorIID, (nsISupports**)&locator); - if (NS_FAILED(rv)) { - return rv; - } - if (!locator) { - return NS_ERROR_FAILURE; - } - rv = locator->GetFileLocation - (nsSpecialFileSpec::App_UserProfileDirectory50, &dirSpec); - nsServiceManager::ReleaseService(kFileLocatorCID, locator); - return rv; + nsIFileSpec* spec = NS_LocateFileOrDirectory( + nsSpecialFileSpec::App_UserProfileDirectory50); + if (!spec) + return NS_ERROR_FAILURE; + return spec->GetFileSpec(&dirSpec); } #ifndef XP_MAC diff --git a/mozilla/extensions/wallet/src/wallet.cpp b/mozilla/extensions/wallet/src/wallet.cpp index ed144742c49..a74b0236d90 100644 --- a/mozilla/extensions/wallet/src/wallet.cpp +++ b/mozilla/extensions/wallet/src/wallet.cpp @@ -41,6 +41,7 @@ #include "nsIStringBundle.h" #include "nsILocale.h" #include "nsIFileLocator.h" +#include "nsIFileSpec.h" #include "nsFileLocations.h" #include "xp_mem.h" #include "prmem.h" @@ -684,20 +685,12 @@ Wallet_BadKey() { } PUBLIC nsresult Wallet_ProfileDirectory(nsFileSpec& dirSpec) { - nsresult rv; - nsIFileLocator* locator = nsnull; - rv = nsServiceManager::GetService - (kFileLocatorCID, kIFileLocatorIID, (nsISupports**)&locator); - if (NS_FAILED(rv)) { - return rv; - } - if (!locator) { - return NS_ERROR_FAILURE; - } - rv = locator->GetFileLocation - (nsSpecialFileSpec::App_UserProfileDirectory50, &dirSpec); - nsServiceManager::ReleaseService(kFileLocatorCID, locator); - return rv; + + nsIFileSpec* spec = NS_LocateFileOrDirectory( + nsSpecialFileSpec::App_UserProfileDirectory50); + if (!spec) + return NS_ERROR_FAILURE; + return spec->GetFileSpec(&dirSpec); } /* returns -1 if key does not exist, 0 if key is of length 0, 1 otherwise */ diff --git a/mozilla/network/protocol/http/nsCookie.cpp b/mozilla/network/protocol/http/nsCookie.cpp index ae02ce53b2f..388d52ac92e 100644 --- a/mozilla/network/protocol/http/nsCookie.cpp +++ b/mozilla/network/protocol/http/nsCookie.cpp @@ -34,6 +34,7 @@ #include "nsIStringBundle.h" #include "nsFileStream.h" #include "nsIFileLocator.h" +#include "nsIFileSpec.h" #include "nsFileLocations.h" extern "C" { @@ -187,20 +188,11 @@ cookie_Localize(char* genericString) { } PRIVATE nsresult cookie_ProfileDirectory(nsFileSpec& dirSpec) { - nsresult rv; - nsIFileLocator* locator = nsnull; - rv = nsServiceManager::GetService - (kFileLocatorCID, kIFileLocatorIID, (nsISupports**)&locator); - if (NS_FAILED(rv)) { - return rv; - } - if (!locator) { - return NS_ERROR_FAILURE; - } - rv = locator->GetFileLocation - (nsSpecialFileSpec::App_UserProfileDirectory50, &dirSpec); - nsServiceManager::ReleaseService(kFileLocatorCID, locator); - return rv; + nsIFileSpec* spec = NS_LocateFileOrDirectory( + nsSpecialFileSpec::App_UserProfileDirectory50); + if (!spec) + return NS_ERROR_FAILURE; + return spec->GetFileSpec(&dirSpec); } #ifndef XP_MAC diff --git a/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp b/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp index 1baca34cc2c..cc191118687 100644 --- a/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp +++ b/mozilla/xpfe/AppCores/src/nsBrowserAppCore.cpp @@ -68,9 +68,8 @@ #ifdef ClientWallet #include "nsIFileLocator.h" +#include "nsIFileSpec.h" #include "nsFileLocations.h" -static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); -static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); #include "nsIWalletService.h" static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID); static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID); @@ -329,20 +328,11 @@ nsBrowserAppCore::Stop() //#define WALLET_SAMPLES_URL "http://peoplestage/morse/wallet/samples/" nsresult ProfileDirectory(nsFileSpec& dirSpec) { - nsresult rv; - nsIFileLocator* locator = nsnull; - rv = nsServiceManager::GetService - (kFileLocatorCID, kIFileLocatorIID, (nsISupports**)&locator); - if (NS_FAILED(rv)) { - return rv; - } - if (!locator) { - return NS_ERROR_FAILURE; - } - rv = locator->GetFileLocation - (nsSpecialFileSpec::App_UserProfileDirectory50, &dirSpec); - nsServiceManager::ReleaseService(kFileLocatorCID, locator); - return rv; + nsIFileSpec* spec = NS_LocateFileOrDirectory( + nsSpecialFileSpec::App_UserProfileDirectory50); + if (!spec) + return NS_ERROR_FAILURE; + return spec->GetFileSpec(&dirSpec); } PRInt32