Back out fix for bug # 113894 due to bug # 120617. a=sheriff suresh

This commit is contained in:
rjc%netscape.com 2002-01-18 07:20:36 +00:00
parent ac965f56c7
commit bc9808dcba

View File

@ -42,9 +42,6 @@
*/
#include "nsNetUtil.h"
#include "nsIURI.h"
#include "nsIIOService.h"
#include "nsIFileSpec.h"
#include "nsFileStream.h"
#include "nsIComponentManager.h"
@ -399,24 +396,20 @@ LocalStoreImpl::LoadData()
// directory. Bomb if we can't find it.
nsCOMPtr<nsIFile> aFile;
nsCOMPtr<nsIFileSpec> tempSpec;
rv = NS_GetSpecialDirectory(NS_APP_LOCALSTORE_50_FILE, getter_AddRefs(aFile));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIURI> aURI;
rv = NS_NewFileURI(getter_AddRefs(aURI), aFile);
if (NS_FAILED(rv)) return rv;
// Turn the nsIFile into a nsFileSpec.
// This is evil! nsOutputFileStream needs
// to take an nsILocalFile (bug #46394)
nsXPIDLCString pathBuf;
rv = aURI->GetSpec(getter_Copies(pathBuf));
rv = aFile->GetPath(getter_Copies(pathBuf));
if (NS_FAILED(rv)) return rv;
nsFileSpec spec((const char *)pathBuf);
PRBool fileExistsFlag = PR_FALSE;
if (NS_SUCCEEDED(rv = aFile->Exists(&fileExistsFlag)) && (!fileExistsFlag)) {
// Turn the nsIFile into a nsFileSpec.
// This is evil! nsOutputFileStream needs
// to take an nsILocalFile (bug #46394)
nsFileSpec spec(pathBuf);
if (! spec.Exists()) {
{
nsOutputFileStream os(spec);
@ -440,7 +433,7 @@ LocalStoreImpl::LoadData()
nsCOMPtr<nsIRDFRemoteDataSource> remote = do_QueryInterface(mInner, &rv);
if (NS_FAILED(rv)) return rv;
rv = remote->Init(pathBuf);
rv = remote->Init((const char*) nsFileURL(spec));
if (NS_FAILED(rv)) return rv;
// Read the datasource synchronously.