fix io.files.temporary for windows
parent
2f7247334e
commit
2753b2442a
|
@ -1,5 +1,5 @@
|
|||
USING: io.backend ;
|
||||
IN: io.files.temporary.backend
|
||||
|
||||
HOOK: (temporary-file) io-backend ( path prefix suffix -- stream path )
|
||||
HOOK: (temporary-file) io-backend ( path -- stream path )
|
||||
HOOK: temporary-path io-backend ( -- path )
|
||||
|
|
|
@ -2,18 +2,14 @@ USING: kernel math math.bitfields combinators.lib math.parser
|
|||
random sequences sequences.lib continuations namespaces
|
||||
io.files io.backend io.nonblocking io arrays
|
||||
io.files.temporary.backend system combinators vocabs.loader ;
|
||||
USE: tools.walker
|
||||
IN: io.files.temporary
|
||||
|
||||
: random-letter ( -- ch )
|
||||
26 random { CHAR: a CHAR: A } random + ;
|
||||
: random-letter ( -- ch ) 26 random { CHAR: a CHAR: A } random + ;
|
||||
|
||||
: random-ch ( -- ch )
|
||||
{ t f } random
|
||||
[ 10 random CHAR: 0 + ] [ random-letter ] if ;
|
||||
{ t f } random [ 10 random CHAR: 0 + ] [ random-letter ] if ;
|
||||
|
||||
: random-name ( n -- string )
|
||||
[ drop random-ch ] "" map-as ;
|
||||
: random-name ( n -- string ) [ drop random-ch ] "" map-as ;
|
||||
|
||||
: <temporary-file> ( prefix suffix -- path duplex-stream )
|
||||
temporary-path -rot
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
USING: kernel system ;
|
||||
USING: io.files.temporary.backend io.nonblocking io.windows
|
||||
kernel system windows.kernel32 ;
|
||||
|
||||
IN: io.windows.files.temporary
|
||||
|
||||
M: windows-io (temporary-file) ( path -- stream )
|
||||
GENERIC_WRITE CREATE_NEW 0 open-file 0 <writer> ;
|
||||
GENERIC_WRITE CREATE_NEW 0 open-file 0 <win32-file> <writer> ;
|
||||
|
||||
M: windows-io temporary-path ( -- path )
|
||||
"TEMP" os-env ;
|
||||
|
|
Loading…
Reference in New Issue