From 0a8e3465cb644e380ab0fc6d66f6d1f17363b34e Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:51:01 +0000 Subject: Sync Author: jgg Date: 1998-10-02 04:39:42 GMT Sync --- apt-pkg/contrib/configuration.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'apt-pkg/contrib/configuration.cc') diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index b12fed6be..433b92244 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: configuration.cc,v 1.5 1998/09/26 05:34:26 jgg Exp $ +// $Id: configuration.cc,v 1.6 1998/10/02 04:39:49 jgg Exp $ /* ###################################################################### Configuration Class @@ -105,6 +105,7 @@ string Configuration::Find(const char *Name,const char *Default) // Configuration::FindDir - Find a directory /*{{{*/ // --------------------------------------------------------------------- /* Directories are stored as the base dir in the Parent node and the + sub directory in sub nodes */ string Configuration::FindDir(const char *Name,const char *Default = 0) { @@ -117,8 +118,16 @@ string Configuration::FindDir(const char *Name,const char *Default = 0) return Default; } + // Absolute path if (Itm->Value[0] == '/' || Itm->Parent == 0) return Itm->Value; + + // ./ is also considered absolute as is anything with ~ in it + if (Itm->Value[0] != 0 && + ((Itm->Value[0] == '.' && Itm->Value[1] == '/') || + (Itm->Value[0] == '~' && Itm->Value[1] == '/'))) + return Itm->Value; + if (Itm->Parent->Value.end()[-1] == '/') return Itm->Parent->Value + Itm->Value; else @@ -167,7 +176,7 @@ bool Configuration::FindB(const char *Name,bool Default) strcasecmp(Itm->Value.c_str(),"true") == 0 || strcasecmp(Itm->Value.c_str(),"with") == 0 || strcasecmp(Itm->Value.c_str(),"enable") == 0) - return false; + return true; return Default; } -- cgit v1.2.3