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