fixes bug 291033 "Enable support for profile temp directory on local filesystem" aka "delete my cache please" r=bsmedberg a=chofmann
git-svn-id: svn://10.0.0.236/trunk@172714 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -135,10 +135,21 @@ nsresult
|
||||
nsFastLoadService::NewFastLoadFile(const char* aBaseName, nsIFile* *aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFile> file;
|
||||
|
||||
nsCOMPtr<nsIFile> profFile;
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
|
||||
getter_AddRefs(profFile));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR,
|
||||
getter_AddRefs(file));
|
||||
if (NS_FAILED(rv))
|
||||
file = profFile;
|
||||
|
||||
PRBool sameDir;
|
||||
rv = file->Equals(profFile, &sameDir);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@@ -149,6 +160,15 @@ nsFastLoadService::NewFastLoadFile(const char* aBaseName, nsIFile* *aResult)
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (!sameDir) {
|
||||
// Cleanup any pre-existing fastload files that may live in the profile
|
||||
// directory from previous versions of the code that didn't store them
|
||||
// in the profile temp directory.
|
||||
rv = profFile->AppendNative(name);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
profFile->Remove(PR_FALSE); // OK if this fails
|
||||
}
|
||||
|
||||
*aResult = file;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
|
||||
Reference in New Issue
Block a user