io.files.windows: add some tests cases for UNC paths. Fixes #44.
parent
3949c53343
commit
39b800907c
|
@ -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" ] [
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue