fix io.files.temporary for windows

db4
Doug Coleman 2008-02-28 16:37:27 -06:00
parent 2f7247334e
commit 2753b2442a
3 changed files with 8 additions and 10 deletions

View File

@ -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 )

View File

@ -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

View File

@ -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 ;