diff options
Diffstat (limited to 'apt-pkg/policy.cc')
-rw-r--r-- | apt-pkg/policy.cc | 11 |
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()); |