- MAX_PATH 1 + [ <ushort-array> ] keep
- dupd
- FindFirstVolume dup win32-error=0/f
- [ utf16n alien>string ] dip ;
-
-:: find-next-volume ( handle -- string/f )
- MAX_PATH 1 + :> buf-length
- buf-length <ushort-array> :> buf
-
- handle buf buf-length FindNextVolume :> ret
- ret 0 = [
- GetLastError ERROR_NO_MORE_FILES =
- [ f ] [ win32-error-string throw ] if
- ] [
- buf utf16n alien>string
- ] if ;
+ { { ushort path-length } }
+ [ path-length FindFirstVolume dup win32-error=0/f ]
+ [ utf16n alien>string ]
+ with-out-parameters swap ;
+
+: find-next-volume ( handle -- string/f )
+ { { ushort path-length } }
+ [ path-length FindNextVolume ]
+ [
+ swap 0 = [
+ GetLastError ERROR_NO_MORE_FILES =
+ [ drop f ] [ win32-error-string throw ] if
+ ] [ utf16n alien>string ] if
+ ] with-out-parameters ;