mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Create mPath when needed to avoid empty nsFileSpec on Mac.
This commit is contained in:
parent
ff58eed078
commit
492e685f8f
@ -61,10 +61,11 @@ static NS_DEFINE_CID(kCNewsDB, NS_NEWSDB_CID);
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsMsgNewsFolder::nsMsgNewsFolder(void)
|
||||
: nsMsgFolder(), mPath(""), mExpungedBytes(0),
|
||||
: nsMsgFolder(), mExpungedBytes(0),
|
||||
mHaveReadNameFromDB(PR_FALSE), mGettingNews(PR_FALSE),
|
||||
mInitialized(PR_FALSE), mNewsDatabase(nsnull), m_optionLines(nsnull)
|
||||
{
|
||||
mPath = nsnull;
|
||||
// NS_INIT_REFCNT(); done by superclass
|
||||
}
|
||||
|
||||
@ -74,6 +75,9 @@ nsMsgNewsFolder::~nsMsgNewsFolder(void)
|
||||
//Close releases db;
|
||||
mNewsDatabase->Close(PR_TRUE);
|
||||
|
||||
if (mPath)
|
||||
delete mPath;
|
||||
|
||||
PR_FREEIF(m_optionLines);
|
||||
}
|
||||
|
||||
@ -851,6 +855,9 @@ nsresult nsMsgNewsFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, ns
|
||||
{
|
||||
nsresult openErr=NS_ERROR_UNEXPECTED;
|
||||
if(!db || !folderInfo)
|
||||
return NS_ERROR_NULL_POINTER; //ducarroz: should we use NS_ERROR_INVALID_ARG?
|
||||
|
||||
if (!mPath)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsIMsgDatabase *newsDBFactory = nsnull;
|
||||
@ -859,7 +866,7 @@ nsresult nsMsgNewsFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, ns
|
||||
nsresult rv = nsComponentManager::CreateInstance(kCNewsDB, nsnull, nsIMsgDatabase::GetIID(), (void **) &newsDBFactory);
|
||||
if (NS_SUCCEEDED(rv) && newsDBFactory)
|
||||
{
|
||||
openErr = newsDBFactory->Open(mPath, PR_FALSE, (nsIMsgDatabase **) &newsDB, PR_FALSE);
|
||||
openErr = newsDBFactory->Open(*mPath, PR_FALSE, (nsIMsgDatabase **) &newsDB, PR_FALSE);
|
||||
newsDBFactory->Release();
|
||||
}
|
||||
|
||||
@ -1017,12 +1024,15 @@ NS_IMETHODIMP nsMsgNewsFolder::GetRememberedPassword(char ** password)
|
||||
|
||||
NS_IMETHODIMP nsMsgNewsFolder::GetPath(nsFileSpec& aPathName)
|
||||
{
|
||||
nsFileSpec nopath("");
|
||||
if (mPath == nopath) {
|
||||
nsresult rv = nsNewsURI2Path(kNewsRootURI, mURI, mPath);
|
||||
if (! mPath) {
|
||||
mPath = new nsNativeFileSpec("");
|
||||
if (! mPath)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = nsNewsURI2Path(kNewsRootURI, mURI, *mPath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
aPathName = mPath;
|
||||
aPathName = *mPath;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ protected:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
nsNativeFileSpec mPath;
|
||||
nsNativeFileSpec *mPath;
|
||||
PRUint32 mExpungedBytes;
|
||||
PRBool mHaveReadNameFromDB;
|
||||
PRBool mGettingNews;
|
||||
|
Loading…
Reference in New Issue
Block a user