From 174debf33b2001b3244c007825d0a5539566bd8c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 7 Mar 2007 20:18:43 +0000 Subject: [PATCH] strutils.h -> strings/utils.h Small bugfix --- Build | 1 + source/path.cpp | 6 ++++-- source/utils.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Build b/Build index bfd56d3..43bd137 100644 --- a/Build +++ b/Build @@ -4,6 +4,7 @@ package "msppath" description "Filesystem utilities"; require "mspmisc"; + require "mspstrings"; library "msppath" { diff --git a/source/path.cpp b/source/path.cpp index e79a8fe..4f3a0b1 100644 --- a/source/path.cpp +++ b/source/path.cpp @@ -3,7 +3,7 @@ This file is part of libmsppath Copyright © 2006 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ -#include +#include #include "path.h" #include "utils.h" @@ -166,8 +166,10 @@ void Path::add_component(const string &comp) path.erase(slash, string::npos); } } - else if(comp!=".") + else if(comp!="." || path.empty()) { + if(path==".") + path=""; if(path.size()>1 || (path.size()==1 && path[0]!=DIRCHAR)) path+=DIRCHAR; path+=comp; diff --git a/source/utils.cpp b/source/utils.cpp index 45cd614..5c7d6a2 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -9,7 +9,7 @@ Distributed under the LGPL #ifndef WIN32 #include #endif -#include +#include #include "path.h" #include "utils.h" -- 2.43.0