зеркало из https://github.com/mozilla/pjs.git
[not part of build] create the cache directory if it doesn't exist already.
This commit is contained in:
Родитель
a413a0dc6e
Коммит
86cd82e240
|
@ -86,6 +86,7 @@ static nsresult installPrefListeners(nsDiskCacheDevice* device)
|
|||
rv = cacheDirectory->Append("Cache");
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = prefs->SetFileXPref(CACHE_DIR_PREF, cacheDirectory);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -93,6 +94,11 @@ static nsresult installPrefListeners(nsDiskCacheDevice* device)
|
|||
return rv;
|
||||
#endif
|
||||
} else {
|
||||
// be a good citizen in the current Cache directory.
|
||||
rv = cacheDirectory->Append("NewCache");
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// cause the preference to be set up initially.
|
||||
device->setCacheDirectory(cacheDirectory);
|
||||
}
|
||||
|
@ -344,6 +350,12 @@ nsDiskCacheDevice::OnDataSizeChange(nsCacheEntry * entry, PRInt32 deltaSize)
|
|||
void nsDiskCacheDevice::setCacheDirectory(nsILocalFile* cacheDirectory)
|
||||
{
|
||||
mCacheDirectory = cacheDirectory;
|
||||
|
||||
// make sure the Cache directory exists.
|
||||
PRBool exists;
|
||||
nsresult rv = cacheDirectory->Exists(&exists);
|
||||
if (NS_SUCCEEDED(rv) && !exists)
|
||||
cacheDirectory->Create(nsIFile::DIRECTORY_TYPE, 0777);
|
||||
}
|
||||
|
||||
nsresult nsDiskCacheDevice::getFileForKey(const char* key, PRBool meta, nsIFile ** result)
|
||||
|
|
Загрузка…
Ссылка в новой задаче