]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/cachefile.cc
* apt-pkg/init.cc:
[apt.git] / apt-pkg / cachefile.cc
index 964c5bd8bc9ad486472ea3854947bac4fc809874..a76cfc08e2184f1b8c100184473e3d6f72151d7d 100644 (file)
@@ -163,6 +163,20 @@ bool pkgCacheFile::Open(OpProgress *Progress, bool WithLock)
    return true;
 }
                                                                        /*}}}*/
+// CacheFile::RemoveCaches - remove all cache files from disk          /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void pkgCacheFile::RemoveCaches()
+{
+   std::string const pkgcache = _config->FindFile("Dir::cache::pkgcache");
+   std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+
+   if (pkgcache.empty() == false && RealFileExists(pkgcache) == true)
+      unlink(pkgcache.c_str());
+   if (srcpkgcache.empty() == false && RealFileExists(srcpkgcache) == true)
+      unlink(srcpkgcache.c_str());
+}
+                                                                       /*}}}*/
 // CacheFile::Close - close the cache files                            /*{{{*/
 // ---------------------------------------------------------------------
 /* */