summaryrefslogtreecommitdiff
path: root/apt-pkg/policy.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2009-07-15 23:57:07 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2009-07-15 23:57:07 +0200
commit6009e60d0192832277242438ad7ca2fc24a4c075 (patch)
treeca691ec88f3522952210a534df6551813b80778c /apt-pkg/policy.cc
parent9d800312c90b7d3b52f2f4c3cea3ebfc67bf000b (diff)
display warnings instead of errors if the parts dirs doesn't exist
Parts dirs are /etc/apt/{sources.list,apt.conf,preferences}.d (in the default setup)
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r--apt-pkg/policy.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc
index 26d1c17bd..81fdb0431 100644
--- a/apt-pkg/policy.cc
+++ b/apt-pkg/policy.cc
@@ -267,12 +267,21 @@ class PreferenceSection : public pkgTagSection
/*}}}*/
// ReadPinDir - Load the pin files from this dir into a Policy /*{{{*/
// ---------------------------------------------------------------------
-/* */
+/* This will load each pin file in the given dir into a Policy. If the
+ given dir is empty the dir set in Dir::Etc::PreferencesParts is used.
+ Note also that this method will issue a warning if the dir does not
+ exists but it will return true in this case! */
bool ReadPinDir(pkgPolicy &Plcy,string Dir)
{
if (Dir.empty() == true)
Dir = _config->FindDir("Dir::Etc::PreferencesParts");
+ if (FileExists(Dir) == false)
+ {
+ _error->WarningE("FileExists",_("Unable to read %s"),Dir.c_str());
+ return true;
+ }
+
DIR *D = opendir(Dir.c_str());
if (D == 0)
return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());