Commit d04771d3 authored by Scott Wheeler's avatar Scott Wheeler
Browse files

Write the cache to a temporary cache first and then move that over the stored

one.  This should reduce the liklihood of corrupted caches.

svn path=/trunk/kdemultimedia/juk/; revision=220553
parent 1f02c0b4
......@@ -18,6 +18,8 @@
#include <kstandarddirs.h>
#include <kdebug.h>
#include <qdir.h>
#include "cache.h"
#include "cachedtag.h"
......@@ -38,7 +40,8 @@ Cache *Cache::instance()
void Cache::save()
{
QString cacheFileName = KGlobal::dirs()->saveLocation("appdata") + "cache";
QString dirName = KGlobal::dirs()->saveLocation("appdata");
QString cacheFileName = dirName + "cache.new";
QFile f(cacheFileName);
......@@ -53,6 +56,8 @@ void Cache::save()
}
f.close();
QDir dir(dirName);
dir.rename("cache.new", "cache");
}
////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment