io.files.info.windows: add open-read-handle to reuse later
parent
2b68636207
commit
2264638a61
|
@ -76,15 +76,20 @@ TUPLE: windows-file-info < file-info-tuple attributes ;
|
||||||
[ GetFileInformationByHandle win32-error=0/f ] keep
|
[ GetFileInformationByHandle win32-error=0/f ] keep
|
||||||
] keep CloseHandle win32-error=0/f ;
|
] keep CloseHandle win32-error=0/f ;
|
||||||
|
|
||||||
: get-file-information-stat ( path -- file-info )
|
: valid-handle? ( handle -- boolean )
|
||||||
dup
|
INVALID_HANDLE_VALUE = not ; inline
|
||||||
|
|
||||||
|
: open-read-handle ( path -- handle/f )
|
||||||
GENERIC_READ FILE_SHARE_READ f
|
GENERIC_READ FILE_SHARE_READ f
|
||||||
OPEN_EXISTING FILE_FLAG_BACKUP_SEMANTICS f
|
OPEN_EXISTING FILE_FLAG_BACKUP_SEMANTICS f
|
||||||
CreateFileW dup INVALID_HANDLE_VALUE = [
|
CreateFileW [ valid-handle? ] keep f ? ;
|
||||||
drop find-first-file-stat WIN32_FIND_DATA>file-info
|
|
||||||
] [
|
: get-file-information-stat ( path -- file-info )
|
||||||
|
dup open-read-handle dup [
|
||||||
nip
|
nip
|
||||||
get-file-information BY_HANDLE_FILE_INFORMATION>file-info
|
get-file-information BY_HANDLE_FILE_INFORMATION>file-info
|
||||||
|
] [
|
||||||
|
drop find-first-file-stat WIN32_FIND_DATA>file-info
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
M: windows file-info ( path -- info )
|
M: windows file-info ( path -- info )
|
||||||
|
|
Loading…
Reference in New Issue