From 4746ebf6540fa19978a92a1695de11495701f1ac Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 12 Sep 2008 19:11:08 +0000 Subject: [PATCH] Make dirname behave sensibly for single-component paths --- source/utils.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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); } -- 2.43.0