From: Mikko Rasa Date: Mon, 9 Jul 2012 16:32:17 +0000 (+0300) Subject: Recognize either separator as the root component X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=commitdiff_plain;h=105d334b3dc59b5d5def485e438d63e203805f2e;ds=sidebyside Recognize either separator as the root component --- 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); }