Merge branch 'master' of git://factorcode.org/git/factor
commit
307ad5e9e6
|
@ -1,10 +1,11 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien.c-types io.binary io.backend io.files io.buffers
|
USING: alien.c-types io.binary io.backend io.files io.buffers
|
||||||
io.windows kernel math splitting
|
io.windows kernel math splitting fry alien.strings
|
||||||
windows windows.kernel32 windows.time calendar combinators
|
windows windows.kernel32 windows.time calendar combinators
|
||||||
math.functions sequences namespaces make words symbols system
|
math.functions sequences namespaces make words symbols system
|
||||||
io.ports destructors accessors math.bitwise ;
|
io.ports destructors accessors math.bitwise continuations
|
||||||
|
windows.errors arrays ;
|
||||||
IN: io.windows.files
|
IN: io.windows.files
|
||||||
|
|
||||||
: open-file ( path access-mode create-mode flags -- handle )
|
: open-file ( path access-mode create-mode flags -- handle )
|
||||||
|
@ -113,8 +114,35 @@ M: windows delete-directory ( path -- )
|
||||||
normalize-path
|
normalize-path
|
||||||
RemoveDirectory win32-error=0/f ;
|
RemoveDirectory win32-error=0/f ;
|
||||||
|
|
||||||
M: windows normalize-directory ( string -- string )
|
M: windows >directory-entry ( byte-array -- directory-entry )
|
||||||
normalize-path "\\" ?tail drop "\\*" append ;
|
[ WIN32_FIND_DATA-cFileName utf16n alien>string ]
|
||||||
|
[ WIN32_FIND_DATA-dwFileAttributes ]
|
||||||
|
bi directory-entry boa ;
|
||||||
|
|
||||||
|
: find-first-file ( path -- WIN32_FIND_DATA handle )
|
||||||
|
"WIN32_FIND_DATA" <c-object> tuck
|
||||||
|
FindFirstFile
|
||||||
|
[ INVALID_HANDLE_VALUE = [ win32-error ] when ] keep ;
|
||||||
|
|
||||||
|
: find-next-file ( path -- WIN32_FIND_DATA/f )
|
||||||
|
"WIN32_FIND_DATA" <c-object> tuck
|
||||||
|
FindNextFile 0 = [
|
||||||
|
GetLastError ERROR_NO_MORE_FILES = [
|
||||||
|
win32-error
|
||||||
|
] unless drop f
|
||||||
|
] when ;
|
||||||
|
|
||||||
|
M: windows (directory-entries) ( path -- seq )
|
||||||
|
"\\" ?tail drop "\\*" append
|
||||||
|
find-first-file [ >directory-entry ] dip
|
||||||
|
[
|
||||||
|
'[
|
||||||
|
[ _ find-next-file dup ]
|
||||||
|
[ >directory-entry ]
|
||||||
|
[ drop ] produce
|
||||||
|
over name>> "." = [ nip ] [ swap prefix ] if
|
||||||
|
]
|
||||||
|
] [ '[ _ FindClose win32-error=0/f ] ] bi [ ] cleanup ;
|
||||||
|
|
||||||
SYMBOLS: +read-only+ +hidden+ +system+
|
SYMBOLS: +read-only+ +hidden+ +system+
|
||||||
+archive+ +device+ +normal+ +temporary+
|
+archive+ +device+ +normal+ +temporary+
|
||||||
|
|
|
@ -2,9 +2,9 @@ USING: kernel ;
|
||||||
IN: windows.errors
|
IN: windows.errors
|
||||||
|
|
||||||
: ERROR_SUCCESS 0 ; inline
|
: ERROR_SUCCESS 0 ; inline
|
||||||
|
: ERROR_NO_MORE_FILES 18 ; inline
|
||||||
: ERROR_HANDLE_EOF 38 ; inline
|
: ERROR_HANDLE_EOF 38 ; inline
|
||||||
: ERROR_BROKEN_PIPE 109 ; inline
|
: ERROR_BROKEN_PIPE 109 ; inline
|
||||||
: ERROR_ENVVAR_NOT_FOUND 203 ; inline
|
: ERROR_ENVVAR_NOT_FOUND 203 ; inline
|
||||||
: ERROR_IO_INCOMPLETE 996 ; inline
|
: ERROR_IO_INCOMPLETE 996 ; inline
|
||||||
: ERROR_IO_PENDING 997 ; inline
|
: ERROR_IO_PENDING 997 ; inline
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue