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

Changeset 3061

Show
Ignore:
Timestamp:
12/21/07 03:55:11 (1 year ago)
Author:
larsivi
Message:

Another commit ([3057]) missing from 0.99.4 tag.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tags/releases/0.99.4/tango/util/PathUtil.d

    r3050 r3061  
    157157            } 
    158158        } 
     159        else { 
     160            if (findSlash(path, path.length - 1) < start) 
     161                // segment is filename that starts with ., and at the end 
     162                return path; 
     163            else { 
     164                // not at end 
     165                int idx = findSlashDot(path, start); 
     166                if (idx > -1)  
     167                    return removeDots(path, idx); 
     168                else 
     169                    return path; 
     170            } 
     171        } 
    159172        assert(false, "PathUtil :: invalid code path"); 
    160173    } 
     
    184197    unittest 
    185198    { 
    186         assert (normalize ("foo/bar/././.") == "foo/bar", normalize ("foo/bar/././.")); 
    187         assert (normalize ("././foo/././././bar") == "foo/bar", normalize ("././foo/././././bar")); 
    188         assert (normalize ("/foo/../john") == "/john", normalize("/foo/../john")); 
     199        assert (normalize ("/home/../john/../.tango/.htaccess") == "/.tango/.htaccess", 
     200                normalize ("/home/../john/../.tango/.htaccess")); 
     201        assert (normalize ("/home/../john/../.tango/foo.conf") == "/.tango/foo.conf", 
     202                normalize ("/home/../john/../.tango/foo.conf")); 
     203        assert (normalize ("/home/john/.tango/foo.conf") == "/home/john/.tango/foo.conf", 
     204                normalize ("/home/john/.tango/foo.conf")); 
     205        assert (normalize ("/foo/bar/.htaccess") == "/foo/bar/.htaccess",  
     206                normalize ("/foo/bar/.htaccess")); 
     207        assert (normalize ("foo/bar/././.") == "foo/bar",  
     208                normalize ("foo/bar/././.")); 
     209        assert (normalize ("././foo/././././bar") == "foo/bar",  
     210                normalize ("././foo/././././bar")); 
     211        assert (normalize ("/foo/../john") == "/john",  
     212                normalize("/foo/../john")); 
    189213        assert (normalize ("foo/../john") == "john"); 
    190214        assert (normalize ("foo/bar/..") == "foo");