]> git.tdb.fi Git - libs/core.git/blobdiff - source/fs/path.cpp
Fix a 64-bit compile error
[libs/core.git] / source / fs / path.cpp
index 241b2f8aeb938493f006d735f36a9f8f4c41e6ec..4db7f0cc140185d46234aa54eebfb1042af4e160 100644 (file)
@@ -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<string::size_type>(slash-start, 1U)));
                if(slash==string::npos)
                        break;
                start = slash+1;
@@ -89,7 +89,7 @@ Path Path::operator/(const Path &p) const
 Path &Path::operator/=(const Path &p)
 {
        if(p.is_absolute())
-               path = p.path;
+               *this = p;
        else
        {
                for(Iterator i=p.begin(); i!=p.end(); ++i)
@@ -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);
                }