From 7753e4684e2b80abbed296b90f47be12b4fce8fc Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 6 Sep 2010 14:10:26 +0200 Subject: rename the newly public CheckDirectory method to CreateAPTDirectoryIfNeeded to give a better indication what this method will do if called. --- apt-pkg/acquire.cc | 8 ++++---- apt-pkg/contrib/fileutl.cc | 4 ++-- apt-pkg/contrib/fileutl.h | 2 +- apt-pkg/deb/dpkgpm.cc | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 6ec557397..9478cdfb4 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -74,12 +74,12 @@ bool pkgAcquire::Setup(pkgAcquireStatus *Progress, string const &Lock) string const archivesDir = _config->FindDir("Dir::Cache::Archives"); string const partialArchivesDir = archivesDir + "partial/"; - if (CheckDirectory(_config->FindDir("Dir::State"), partialListDir) == false && - CheckDirectory(listDir, partialListDir) == false) + if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::State"), partialListDir) == false && + CreateAPTDirectoryIfNeeded(listDir, partialListDir) == false) return _error->Errno("Acquire", _("List directory %spartial is missing."), listDir.c_str()); - if (CheckDirectory(_config->FindDir("Dir::Cache"), partialArchivesDir) == false && - CheckDirectory(archivesDir, partialArchivesDir) == false) + if (CreateAPTDirectoryIfNeeded(_config->FindDir("Dir::Cache"), partialArchivesDir) == false && + CreateAPTDirectoryIfNeeded(archivesDir, partialArchivesDir) == false) return _error->Errno("Acquire", _("Archives directory %spartial is missing."), archivesDir.c_str()); if (Lock.empty() == true || _config->FindB("Debug::NoLocking", false) == true) diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 94d994e8b..eabaadf90 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -251,11 +251,11 @@ bool CreateDirectory(string const &Parent, string const &Path) return true; } /*}}}*/ -// CheckDirectory - ensure that the given directory exists /*{{{*/ +// CreateAPTDirectoryIfNeeded - ensure that the given directory exists /*{{{*/ // --------------------------------------------------------------------- /* a small wrapper around CreateDirectory to check if it exists and to remove the trailing "/apt/" from the parent directory if needed */ -bool CheckDirectory(string const &Parent, string const &Path) +bool CreateAPTDirectoryIfNeeded(string const &Parent, string const &Path) { if (DirectoryExists(Path) == true) return true; diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index f79c9032f..419506273 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -101,7 +101,7 @@ bool CreateDirectory(string const &Parent, string const &Path); * /apt/ will be removed before CreateDirectory call. * \param Path which should exist after (successful) call */ -bool CheckDirectory(string const &Parent, string const &Path); +bool CreateAPTDirectoryIfNeeded(string const &Parent, string const &Path); std::vector GetListOfFilesInDir(string const &Dir, string const &Ext, bool const &SortList, bool const &AllowNoExt=false); diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index d3c432ce1..395c3fb1a 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -641,7 +641,7 @@ void pkgDPkgPM::WriteHistoryTag(string const &tag, string value) bool pkgDPkgPM::OpenLog() { string const logdir = _config->FindDir("Dir::Log"); - if(CheckDirectory(logdir, logdir) == false) + if(CreateAPTDirectoryIfNeeded(logdir, logdir) == false) // FIXME: use a better string after freeze return _error->Error(_("Directory '%s' missing"), logdir.c_str()); -- cgit v1.2.3