metaindex.cc 809 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include <apt-pkg/strutl.h>
  2. #include "init.h"
  3. #include "metaindex.h"
  4. #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
  5. string metaIndex::MetaIndexInfo(const char *Type) const
  6. {
  7. string Info = ::URI::SiteOnly(URI) + ' ';
  8. if (Dist[Dist.size() - 1] == '/')
  9. {
  10. if (Dist != "/")
  11. Info += Dist;
  12. }
  13. else
  14. Info += Dist;
  15. Info += " ";
  16. Info += Type;
  17. return Info;
  18. }
  19. string metaIndex::MetaIndexFile(const char *Type) const
  20. {
  21. return _config->FindDir("Dir::State::lists") +
  22. URItoFileName(MetaIndexURI(Type));
  23. }
  24. string metaIndex::MetaIndexURI(const char *Type) const
  25. {
  26. string Res;
  27. if (Dist == "/")
  28. Res = URI;
  29. else if (Dist[Dist.size()-1] == '/')
  30. Res = URI + Dist;
  31. else
  32. Res = URI + "dists/" + Dist + "/";
  33. Res += Type;
  34. return Res;
  35. }
  36. #endif