io.files.windows: add some tests cases for UNC paths. Fixes #44.

db4
John Benediktsson 2011-08-28 12:55:09 -07:00
parent 3949c53343
commit 39b800907c
2 changed files with 11 additions and 2 deletions

View File

@ -36,6 +36,9 @@ IN: io.files.windows.tests
[ t ] [ "\\\\?\\c:" root-directory? ] unit-test
[ f ] [ "\\\\?\\c:\\bar" root-directory? ] unit-test
[ "\\\\a\\b\\c\\foo.xls" ] [ "//a/b/c/foo.xls" normalize-path ] unit-test
[ "\\\\a\\b\\c\\foo.xls" ] [ "\\\\a\\b\\c\\foo.xls" normalize-path ] unit-test
[ "\\foo\\bar" ] [ "/foo/bar" normalize-path ":" split1 nip ] unit-test
[ "\\\\?\\C:\\builds\\factor\\log.txt" ] [

View File

@ -324,9 +324,15 @@ M: winnt root-directory? ( path -- ? )
TR: normalize-separators "/" "\\" ;
<PRIVATE
: unc-path? ( string -- ? )
[ "//" head? ] [ "\\\\" head? ] bi or ;
PRIVATE>
M: winnt normalize-path ( string -- string' )
dup [ "//" head? ] [ "\\\\" head? ] bi
or [
dup unc-path? [
normalize-separators
] [
absolute-path