io.backend: Remove duplicate definition of file-mode. Add mkdir-mode using non-magic symbols. Cleanup imports.
parent
01187b378c
commit
be232dac9b
|
@ -1,16 +1,16 @@
|
|||
! Copyright (C) 2004, 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien alien.c-types alien.data alien.syntax generic
|
||||
assocs kernel kernel.private math io.ports sequences strings
|
||||
sbufs threads unix unix.ffi unix.stat vectors io.buffers io.backend
|
||||
io.encodings io.files math.parser continuations system libc namespaces
|
||||
make io.timeouts io.encodings.utf8 destructors
|
||||
destructors.private accessors summary combinators locals
|
||||
unix.time unix.types fry io.backend.unix.multiplexers
|
||||
classes.struct hints ;
|
||||
USING: accessors alien.c-types alien.data alien.syntax
|
||||
classes.struct combinators destructors destructors.private fry
|
||||
hints io.backend io.backend.unix.multiplexers io.buffers
|
||||
io.files io.ports io.timeouts kernel kernel.private libc
|
||||
literals locals make math namespaces sequences summary system
|
||||
threads unix unix.ffi unix.stat unix.types ;
|
||||
QUALIFIED: io
|
||||
IN: io.backend.unix
|
||||
|
||||
CONSTANT: file-mode 0o0666
|
||||
|
||||
GENERIC: handle-fd ( handle -- fd )
|
||||
|
||||
TUPLE: fd < disposable fd ;
|
||||
|
@ -82,7 +82,6 @@ M: unix wait-for-fd ( handle event -- )
|
|||
'[ handle>> _ wait-for-fd ] with-timeout ;
|
||||
|
||||
! Some general stuff
|
||||
CONSTANT: file-mode 0o0666
|
||||
|
||||
M: fd refill
|
||||
fd>> over buffer>> [ buffer-end ] [ buffer-capacity ] bi read
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors alien.c-types alien.data alien.strings
|
||||
assocs combinators continuations destructors fry io io.backend
|
||||
io.directories io.encodings.binary io.files.info.unix
|
||||
io.encodings.utf8 io.files io.pathnames io.files.types kernel
|
||||
math math.bitwise sequences system unix unix.stat vocabs.loader
|
||||
classes.struct unix.ffi literals libc vocabs io.files.info ;
|
||||
USING: accessors alien.c-types alien.data alien.strings assocs
|
||||
classes.struct continuations fry io.backend io.backend.unix
|
||||
io.directories io.encodings.utf8 io.files io.files.info
|
||||
io.files.info.unix io.files.types kernel libc literals math
|
||||
sequences system unix unix.ffi vocabs ;
|
||||
IN: io.directories.unix
|
||||
|
||||
CONSTANT: file-mode 0o0666
|
||||
|
||||
CONSTANT: touch-mode flags{ O_WRONLY O_APPEND O_CREAT O_EXCL }
|
||||
|
||||
CONSTANT: mkdir-mode flags{ USER-ALL GROUP-ALL OTHER-ALL } ! 0o777
|
||||
|
||||
M: unix touch-file ( path -- )
|
||||
normalize-path
|
||||
dup exists? [ touch ] [
|
||||
|
@ -24,7 +23,7 @@ M: unix move-file ( from to -- )
|
|||
M: unix delete-file ( path -- ) normalize-path unlink-file ;
|
||||
|
||||
M: unix make-directory ( path -- )
|
||||
normalize-path 0o777 [ mkdir ] unix-system-call drop ;
|
||||
normalize-path mkdir-mode [ mkdir ] unix-system-call drop ;
|
||||
|
||||
M: unix delete-directory ( path -- )
|
||||
normalize-path [ rmdir ] unix-system-call drop ;
|
||||
|
|
Loading…
Reference in New Issue