// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: clean.cc,v 1.1 1999/02/01 08:11:57 jgg Exp $
+// $Id: clean.cc,v 1.3 1999/10/03 21:09:27 jgg Exp $
/* ######################################################################
Clean - Clean out downloaded directories
#include <apt-pkg/clean.h>
#include <apt-pkg/strutl.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
#include <dirent.h>
#include <sys/stat.h>
against our database to see if it is interesting */
bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
{
+ bool CleanInstalled = _config->FindB("APT::Clean-Installed",true);
+
DIR *D = opendir(Dir.c_str());
if (D == 0)
return _error->Errno("opendir","Unable to read %s",Dir.c_str());
for (pkgCache::VerFileIterator J = V.FileList();
J.end() == false; J++)
{
- if ((J.File()->Flags & pkgCache::Flag::NotSource) != 0)
+ if (CleanInstalled == true &&
+ (J.File()->Flags & pkgCache::Flag::NotSource) != 0)
continue;
IsFetchable = true;
break;
}
Erase(Dir->d_name,Pkg,Ver,St);
- unlink(Dir->d_name);
};
chdir(StartDir.c_str());