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
|
[ t ] [ "\\\\?\\c:" root-directory? ] unit-test
|
||||||
[ f ] [ "\\\\?\\c:\\bar" 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
|
[ "\\foo\\bar" ] [ "/foo/bar" normalize-path ":" split1 nip ] unit-test
|
||||||
|
|
||||||
[ "\\\\?\\C:\\builds\\factor\\log.txt" ] [
|
[ "\\\\?\\C:\\builds\\factor\\log.txt" ] [
|
||||||
|
|
|
@ -324,9 +324,15 @@ M: winnt root-directory? ( path -- ? )
|
||||||
|
|
||||||
TR: normalize-separators "/" "\\" ;
|
TR: normalize-separators "/" "\\" ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
|
: unc-path? ( string -- ? )
|
||||||
|
[ "//" head? ] [ "\\\\" head? ] bi or ;
|
||||||
|
|
||||||
|
PRIVATE>
|
||||||
|
|
||||||
M: winnt normalize-path ( string -- string' )
|
M: winnt normalize-path ( string -- string' )
|
||||||
dup [ "//" head? ] [ "\\\\" head? ] bi
|
dup unc-path? [
|
||||||
or [
|
|
||||||
normalize-separators
|
normalize-separators
|
||||||
] [
|
] [
|
||||||
absolute-path
|
absolute-path
|
||||||
|
|
Loading…
Reference in New Issue