From: Mikko Rasa Date: Fri, 12 Sep 2008 19:11:08 +0000 (+0000) Subject: Make dirname behave sensibly for single-component paths X-Git-Tag: fs-1.0.1~1 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=4746ebf6540fa19978a92a1695de11495701f1ac;p=libs%2Fcore.git Make dirname behave sensibly for single-component paths --- diff --git a/source/utils.cpp b/source/utils.cpp index 2f7e4d7..abe0d25 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -30,6 +30,12 @@ string basename(const Path &p) Path dirname(const Path &p) { + if(p.size()==1) + { + if(p.is_absolute()) + return p; + return "."; + } return p.subpath(0, p.size()-1); }