From 6009e60d0192832277242438ad7ca2fc24a4c075 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 15 Jul 2009 23:57:07 +0200 Subject: 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) --- apt-pkg/policy.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'apt-pkg/policy.cc') 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()); -- cgit v1.2.3