From be232dac9bb43b685fcb110bbbac8c4c46485777 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 24 Oct 2014 17:16:40 -0700 Subject: [PATCH] io.backend: Remove duplicate definition of file-mode. Add mkdir-mode using non-magic symbols. Cleanup imports. --- basis/io/backend/unix/unix.factor | 17 ++++++++--------- basis/io/directories/unix/unix.factor | 17 ++++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/basis/io/backend/unix/unix.factor b/basis/io/backend/unix/unix.factor index 4cb07d780d..64fe90f18b 100755 --- a/basis/io/backend/unix/unix.factor +++ b/basis/io/backend/unix/unix.factor @@ -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 diff --git a/basis/io/directories/unix/unix.factor b/basis/io/directories/unix/unix.factor index a17a8180df..b401813005 100644 --- a/basis/io/directories/unix/unix.factor +++ b/basis/io/directories/unix/unix.factor @@ -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 ;