io.files.info.windows: suppress ERROR_FILE_NOT_FOUND in volume>paths

char-rename
Alexander Iljin 2016-06-17 02:35:25 +03:00 committed by John Benediktsson
parent cada98f7d8
commit b43c7b4fd7
1 changed files with 9 additions and 1 deletions

View File

@ -201,7 +201,7 @@ CONSTANT: names-buf-length 16384
! Windows may return a volume which looks up to path ""
! For now, treat it like there is not a volume here
: volume>paths ( string -- array )
: (volume>paths) ( string -- array )
[
names-buf-length
[ ushort malloc-array &free ] keep
@ -212,6 +212,14 @@ CONSTANT: names-buf-length 16384
[ { } ] [ [ { 0 } append alien>native-string ] map ] if-empty
] with-destructors ;
! Suppress T{ windows-error f 2 "The system cannot find the file specified." }
: volume>paths ( string -- array )
[ (volume>paths) ] curry
[
dup { [ windows-error? ] [ n>> ERROR_FILE_NOT_FOUND = ] } 1&&
[ drop { } ] [ rethrow ] if
] recover ;
! Can error with T{ windows-error f 21 "The device is not ready." }
! if there is a D: that is not ready, for instance. Ignore these drives.
M: windows file-systems ( -- array )