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