Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3904

Show
Ignore:
Timestamp:
08/24/08 10:37:49 (3 months ago)
Author:
larsivi
Message:

Normalize double slashes into single slashes, thanks aziz

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tango/util/PathUtil.d

    r3764 r3904  
    8282        assert(start < end); 
    8383        foreach(i, c; path[start..end-1])  
    84             if (c == '/')  
     84            if (c == '/') { 
     85                if (path[start+i+1] == '/') 
     86                    truncate(path, path[0..start+i+1], path[start+i+2..end]); 
    8587                if (path[start+i+1] == '.')  
    8688                    return i + start + 1; 
     89            } 
    8790 
    8891        return -1; 
     
    249252        assert (normalize ("d/") == "d/"); 
    250253        assert (normalize ("/home/john/./foo/bar.txt") == "/home/john/foo/bar.txt"); 
     254        assert (normalize ("/home//john") == "/home/john"); 
    251255 
    252256version (Windows) {