update io.files.*.windows to use specialized arrays; also, io.files.info.windows was providing buffers that were too small, so fix that
parent
72bb3e144f
commit
c1fe3854d4
|
@ -5,7 +5,8 @@ io.files.windows io.files.windows.nt kernel windows.kernel32
|
||||||
windows.time windows accessors alien.c-types combinators
|
windows.time windows accessors alien.c-types combinators
|
||||||
generalizations system alien.strings io.encodings.utf16n
|
generalizations system alien.strings io.encodings.utf16n
|
||||||
sequences splitting windows.errors fry continuations destructors
|
sequences splitting windows.errors fry continuations destructors
|
||||||
calendar ascii combinators.short-circuit locals classes.struct ;
|
calendar ascii combinators.short-circuit locals classes.struct
|
||||||
|
specialized-arrays.ushort ;
|
||||||
IN: io.files.info.windows
|
IN: io.files.info.windows
|
||||||
|
|
||||||
:: round-up-to ( n multiple -- n' )
|
:: round-up-to ( n multiple -- n' )
|
||||||
|
@ -100,11 +101,11 @@ M: windows link-info ( path -- info )
|
||||||
file-info ;
|
file-info ;
|
||||||
|
|
||||||
: volume-information ( normalized-path -- volume-name volume-serial max-component flags type )
|
: volume-information ( normalized-path -- volume-name volume-serial max-component flags type )
|
||||||
MAX_PATH 1 + [ <byte-array> ] keep
|
MAX_PATH 1 + [ <ushort-array> ] keep
|
||||||
"DWORD" <c-object>
|
"DWORD" <c-object>
|
||||||
"DWORD" <c-object>
|
"DWORD" <c-object>
|
||||||
"DWORD" <c-object>
|
"DWORD" <c-object>
|
||||||
MAX_PATH 1 + [ <byte-array> ] keep
|
MAX_PATH 1 + [ <ushort-array> ] keep
|
||||||
[ GetVolumeInformation win32-error=0/f ] 7 nkeep
|
[ GetVolumeInformation win32-error=0/f ] 7 nkeep
|
||||||
drop 5 nrot drop
|
drop 5 nrot drop
|
||||||
[ utf16n alien>string ] 4 ndip
|
[ utf16n alien>string ] 4 ndip
|
||||||
|
@ -147,7 +148,7 @@ M: winnt file-system-info ( path -- file-system-info )
|
||||||
calculate-file-system-info ;
|
calculate-file-system-info ;
|
||||||
|
|
||||||
: volume>paths ( string -- array )
|
: volume>paths ( string -- array )
|
||||||
16384 "ushort" <c-array> tuck dup length
|
16384 <ushort-array> tuck dup length
|
||||||
0 <uint> dup [ GetVolumePathNamesForVolumeName 0 = ] dip swap [
|
0 <uint> dup [ GetVolumePathNamesForVolumeName 0 = ] dip swap [
|
||||||
win32-error-string throw
|
win32-error-string throw
|
||||||
] [
|
] [
|
||||||
|
@ -156,13 +157,13 @@ M: winnt file-system-info ( path -- file-system-info )
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: find-first-volume ( -- string handle )
|
: find-first-volume ( -- string handle )
|
||||||
MAX_PATH 1 + [ <byte-array> ] keep
|
MAX_PATH 1 + [ <ushort-array> ] keep
|
||||||
dupd
|
dupd
|
||||||
FindFirstVolume dup win32-error=0/f
|
FindFirstVolume dup win32-error=0/f
|
||||||
[ utf16n alien>string ] dip ;
|
[ utf16n alien>string ] dip ;
|
||||||
|
|
||||||
: find-next-volume ( handle -- string/f )
|
: find-next-volume ( handle -- string/f )
|
||||||
MAX_PATH 1 + [ <byte-array> tuck ] keep
|
MAX_PATH 1 + [ <ushort-array> tuck ] keep
|
||||||
FindNextVolume 0 = [
|
FindNextVolume 0 = [
|
||||||
GetLastError ERROR_NO_MORE_FILES =
|
GetLastError ERROR_NO_MORE_FILES =
|
||||||
[ drop f ] [ win32-error-string throw ] if
|
[ drop f ] [ win32-error-string throw ] if
|
||||||
|
|
|
@ -5,11 +5,11 @@ windows.kernel32 kernel libc math threads system environment
|
||||||
alien.c-types alien.arrays alien.strings sequences combinators
|
alien.c-types alien.arrays alien.strings sequences combinators
|
||||||
combinators.short-circuit ascii splitting alien strings assocs
|
combinators.short-circuit ascii splitting alien strings assocs
|
||||||
namespaces make accessors tr windows.time windows.shell32
|
namespaces make accessors tr windows.time windows.shell32
|
||||||
windows.errors ;
|
windows.errors specialized-arrays.ushort ;
|
||||||
IN: io.files.windows.nt
|
IN: io.files.windows.nt
|
||||||
|
|
||||||
M: winnt cwd
|
M: winnt cwd
|
||||||
MAX_UNICODE_PATH dup "ushort" <c-array>
|
MAX_UNICODE_PATH dup <ushort-array>
|
||||||
[ GetCurrentDirectory win32-error=0/f ] keep
|
[ GetCurrentDirectory win32-error=0/f ] keep
|
||||||
utf16n alien>string ;
|
utf16n alien>string ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue