From 105d334b3dc59b5d5def485e438d63e203805f2e Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 9 Jul 2012 19:32:17 +0300 Subject: [PATCH] Recognize either separator as the root component --- source/fs/path.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/fs/path.cpp b/source/fs/path.cpp index 99bcc8b..703be2b 100644 --- a/source/fs/path.cpp +++ b/source/fs/path.cpp @@ -100,7 +100,7 @@ Path &Path::operator/=(const Path &p) void Path::add_component(const string &comp) { - if(comp.size()==1 && comp[0]==DIRSEP) + if(comp.size()==1 && (comp[0]=='/' || comp[0]=='\\')) { // Replace the path with the root directory #ifdef WIN32 @@ -113,7 +113,7 @@ void Path::add_component(const string &comp) else #endif { - path = comp; + path.assign(1, DIRSEP); separators.clear(); separators.push_back(0); } -- 2.43.0