X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffs%2Fpath.cpp;h=4db7f0cc140185d46234aa54eebfb1042af4e160;hb=c750a22da0df0b54af78374fd66ad1a055327e34;hp=99bcc8bfe216b13101ce51f077ed12d7efd281d4;hpb=4b326cb4916d981d48a2997df3d82b6b3b7b6b92;p=libs%2Fcore.git diff --git a/source/fs/path.cpp b/source/fs/path.cpp index 99bcc8b..4db7f0c 100644 --- a/source/fs/path.cpp +++ b/source/fs/path.cpp @@ -39,7 +39,7 @@ void Path::init(const string &p) { string::size_type slash = p.find_first_of("/\\", start); if(slash>start || start==0) - add_component(p.substr(start, max(slash-start, 1U))); + add_component(p.substr(start, max(slash-start, 1U))); if(slash==string::npos) break; start = slash+1; @@ -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); }