]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/configuration.cc
* Fix typos in manpages. Thanks to Daniel Leidert for the fixes
[apt.git] / apt-pkg / contrib / configuration.cc
index 14a000fa5e39a91deb0af015484295d7210b1257..da57c2054cdfbbd389b8aed86a8a0e89461060cd 100644 (file)
@@ -15,9 +15,6 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include files                                                       /*{{{*/
    ##################################################################### */
                                                                        /*}}}*/
 // Include files                                                       /*{{{*/
-#ifdef __GNUG__
-#pragma implementation "apt-pkg/configuration.h"
-#endif
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
@@ -176,6 +173,11 @@ string Configuration::Find(const char *Name,const char *Default) const
  */
 string Configuration::FindFile(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)
    {
    const Item *Itm = Lookup(Name);
    if (Itm == 0 || Itm->Value.empty() == true)
    {
@@ -207,7 +209,7 @@ string Configuration::FindFile(const char *Name,const char *Default) const
       Itm = Itm->Parent;
    }
 
       Itm = Itm->Parent;
    }
 
-   return val;
+   return rootDir + val;
 }
                                                                        /*}}}*/
 // Configuration::FindDir - Find a directory name                      /*{{{*/
 }
                                                                        /*}}}*/
 // Configuration::FindDir - Find a directory name                      /*{{{*/
@@ -425,6 +427,7 @@ bool Configuration::ExistsAny(const char *Name) const
    string key = Name;
 
    if (key.size() > 2 && key.end()[-2] == '/')
    string key = Name;
 
    if (key.size() > 2 && key.end()[-2] == '/')
+   {
       if (key.find_first_of("fdbi",key.size()-1) < key.size())
       {
          key.resize(key.size() - 2);
       if (key.find_first_of("fdbi",key.size()-1) < key.size())
       {
          key.resize(key.size() - 2);
@@ -435,7 +438,7 @@ bool Configuration::ExistsAny(const char *Name) const
       {
          _error->Warning(_("Unrecognized type abbreviation: '%c'"), key.end()[-3]);
       }
       {
          _error->Warning(_("Unrecognized type abbreviation: '%c'"), key.end()[-3]);
       }
-
+   }
    return Exists(Name);
 }
                                                                        /*}}}*/
    return Exists(Name);
 }
                                                                        /*}}}*/
@@ -509,7 +512,7 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
       CurLine++;
       // This should be made to work instead, but this is better than looping
       if (F.fail() && !F.eof())
       CurLine++;
       // This should be made to work instead, but this is better than looping
       if (F.fail() && !F.eof())
-         return _error->Error(_("Line %d too long (max %d)"), CurLine, sizeof(Buffer));
+         return _error->Error(_("Line %d too long (max %lu)"), CurLine, sizeof(Buffer));
 
       _strtabexpand(Buffer,sizeof(Buffer));
       _strstrip(Buffer);
 
       _strtabexpand(Buffer,sizeof(Buffer));
       _strstrip(Buffer);