diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2007-12-16 18:53:32 -0200 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2007-12-16 18:53:32 -0200 |
commit | db2cca1129fa2d88eae80e1c4a17e263236a95a3 (patch) | |
tree | 2fa70cc26707e15b829c02bd02ae94f5d7e690c8 /apt-pkg | |
parent | 18d38975fb8ff17340ddf0457d74f02a596248fb (diff) |
* apt-pkg/contrib/configuration.cc:
- if RootDir is set, then FindFile and FindDir will return paths
relative to the directory stored in RootDir, closes: #456457.
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 3109fd7a5..e8301d918 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -173,6 +173,11 @@ string Configuration::Find(const char *Name,const char *Default) const */ string Configuration::FindFile(const char *Name,const char *Default) const { + const Item *RootItem = Lookup("RootDir"); + std::string rootDir = (RootItem == 0) ? "" : RootItem->Value; + if(rootDir.size() > 0 && rootDir[rootDir.size() - 1] != '/') + rootDir.push_back('/'); + const Item *Itm = Lookup(Name); if (Itm == 0 || Itm->Value.empty() == true) { @@ -204,7 +209,7 @@ string Configuration::FindFile(const char *Name,const char *Default) const Itm = Itm->Parent; } - return val; + return rootDir + val; } /*}}}*/ // Configuration::FindDir - Find a directory name /*{{{*/ |