Merge branch 'master' of git://factorcode.org/git/factor
commit
c545bc4b53
|
@ -4,8 +4,12 @@ IN: io.windows.nt.files.tests
|
|||
|
||||
[ f ] [ "\\foo" absolute-path? ] unit-test
|
||||
[ t ] [ "\\\\?\\c:\\foo" absolute-path? ] unit-test
|
||||
[ t ] [ "\\\\?\\c:\\" absolute-path? ] unit-test
|
||||
[ t ] [ "\\\\?\\c:" absolute-path? ] unit-test
|
||||
[ t ] [ "c:\\foo" absolute-path? ] unit-test
|
||||
[ t ] [ "c:" absolute-path? ] unit-test
|
||||
[ t ] [ "c:\\" absolute-path? ] unit-test
|
||||
[ f ] [ "/cygdrive/c/builds" absolute-path? ] unit-test
|
||||
|
||||
[ "c:\\foo\\" ] [ "c:\\foo\\bar" parent-directory ] unit-test
|
||||
[ "c:\\" ] [ "c:\\foo\\" parent-directory ] unit-test
|
||||
|
@ -26,6 +30,9 @@ IN: io.windows.nt.files.tests
|
|||
[ f ] [ "c:\\foo" root-directory? ] unit-test
|
||||
[ f ] [ "." root-directory? ] unit-test
|
||||
[ f ] [ ".." root-directory? ] unit-test
|
||||
[ t ] [ "\\\\?\\c:\\" root-directory? ] unit-test
|
||||
[ t ] [ "\\\\?\\c:" root-directory? ] unit-test
|
||||
[ f ] [ "\\\\?\\c:\\bar" root-directory? ] unit-test
|
||||
|
||||
[ "\\foo\\bar" ] [ "/foo/bar" normalize-path ":" split1 nip ] unit-test
|
||||
|
||||
|
|
|
@ -20,11 +20,14 @@ M: winnt cd
|
|||
|
||||
M: winnt root-directory? ( path -- ? )
|
||||
{
|
||||
{ [ dup empty? ] [ f ] }
|
||||
{ [ dup [ path-separator? ] all? ] [ t ] }
|
||||
{ [ dup trim-right-separators { [ length 2 = ] [ second CHAR: : = ] } 1&& ] [ t ] }
|
||||
[ f ]
|
||||
} cond nip ;
|
||||
{ [ dup empty? ] [ drop f ] }
|
||||
{ [ dup [ path-separator? ] all? ] [ drop t ] }
|
||||
{ [ dup trim-right-separators { [ length 2 = ]
|
||||
[ second CHAR: : = ] } 1&& ] [ drop t ] }
|
||||
{ [ dup unicode-prefix head? ]
|
||||
[ trim-right-separators length unicode-prefix length 2 + = ] }
|
||||
[ drop f ]
|
||||
} cond ;
|
||||
|
||||
ERROR: not-absolute-path ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue