]> git.tdb.fi Git - libs/core.git/blobdiff - source/fs/utils.cpp
Remove deprecated things
[libs/core.git] / source / fs / utils.cpp
index ed1ca0ab27c3e3c14070b88822e50cc742ca067c..a2fe40be72ee6f39eef6909e576c5703fe9787da 100644 (file)
@@ -9,11 +9,13 @@ namespace FS {
 
 string basename(const Path &p)
 {
-       return p[-1];
+       return p.empty() ? string() : p[-1];
 }
 
 Path dirname(const Path &p)
 {
+       if(p.empty())
+               return p;
        if(p.size()==1)
        {
                if(p.is_absolute())
@@ -43,7 +45,7 @@ Path fix_case(const Path &path)
        Path result;
        for(Path::Iterator i=path.begin(); i!=path.end(); ++i)
        {
-               if(!found || *i=="/")
+               if(!found || (result.empty() && (*i=="/" || *i==".")))
                        result /= *i;
                else
                {