diff options
author | Michael Vogt <mvo@debian.org> | 2010-09-06 18:11:49 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2010-09-06 18:11:49 +0200 |
commit | fb031c5598c529b98477c47eac6fe11cae4b1b66 (patch) | |
tree | de7908c98e8086a148c423e6edb3d8a6e7455491 /apt-pkg/acquire.cc | |
parent | eb1115ef4e84b90189a50c15af4002e4e7306c01 (diff) | |
parent | 7753e4684e2b80abbed296b90f47be12b4fce8fc (diff) |
merged from lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg/acquire.cc')
-rw-r--r-- | apt-pkg/acquire.cc | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 63825da93..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) @@ -93,27 +93,6 @@ bool pkgAcquire::Setup(pkgAcquireStatus *Progress, string const &Lock) return true; } /*}}}*/ -// Acquire::CheckDirectory - 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 pkgAcquire::CheckDirectory(string const &Parent, string const &Path) const -{ - if (DirectoryExists(Path) == true) - return true; - - size_t const len = Parent.size(); - if (len > 5 && Parent.find("/apt/", len - 6, 5) == len - 5) - { - if (CreateDirectory(Parent.substr(0,len-5), Path) == true) - return true; - } - else if (CreateDirectory(Parent, Path) == true) - return true; - - return false; -} - /*}}}*/ // Acquire::~pkgAcquire - Destructor /*{{{*/ // --------------------------------------------------------------------- /* Free our memory, clean up the queues (destroy the workers) */ |