diff --git a/basis/io/directories/directories.factor b/basis/io/directories/directories.factor index 084facc21b..eb656be6b4 100644 --- a/basis/io/directories/directories.factor +++ b/basis/io/directories/directories.factor @@ -1,9 +1,8 @@ ! Copyright (C) 2004, 2008 Slava Pestov, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays combinators combinators.short-circuit -destructors fry io io.backend io.encodings.binary io.files -io.files.types io.pathnames kernel namespaces sequences -system vocabs vocabs.loader ; +USING: accessors combinators combinators.short-circuit +continuations destructors fry io io.backend io.encodings.binary +io.files io.pathnames kernel namespaces sequences system vocabs ; IN: io.directories : set-current-directory ( path -- ) @@ -55,6 +54,9 @@ HOOK: delete-file io-backend ( path -- ) HOOK: delete-directory io-backend ( path -- ) +: ?delete-file ( path -- ) + '[ _ delete-file ] ignore-errors ; + : to-directory ( from to -- from to' ) over file-name append-path ; diff --git a/basis/vocabs/metadata/metadata.factor b/basis/vocabs/metadata/metadata.factor index 9b144fd317..b09068e1ea 100644 --- a/basis/vocabs/metadata/metadata.factor +++ b/basis/vocabs/metadata/metadata.factor @@ -1,10 +1,10 @@ ! Copyright (C) 2009, 2010 Slava Pestov, Joe Groff. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays assocs io.directories io.encodings.utf8 -io.files io.pathnames kernel make math.parser memoize sequences -sets sorting summary vocabs vocabs.loader words system -classes.algebra combinators.short-circuit fry continuations -namespaces ; +USING: accessors arrays assocs classes.algebra +combinators.short-circuit continuations io.directories +io.encodings.utf8 io.files io.pathnames kernel make math.parser +memoize namespaces sequences sets summary system vocabs +vocabs.loader words ; IN: vocabs.metadata : check-vocab ( vocab -- vocab ) @@ -14,8 +14,6 @@ MEMO: vocab-file-contents ( vocab name -- seq ) vocab-append-path dup [ dup exists? [ utf8 file-lines ] [ drop f ] if ] when ; -: ?delete-file ( pathname -- ) '[ _ delete-file ] ignore-errors ; - : set-vocab-file-contents ( seq vocab name -- ) dupd vocab-append-path [ swap [ ?delete-file ] [ swap utf8 set-file-lines ] if-empty diff --git a/extra/tar/tar.factor b/extra/tar/tar.factor index 09db6b2e63..e56f398008 100644 --- a/extra/tar/tar.factor +++ b/extra/tar/tar.factor @@ -1,10 +1,9 @@ ! Copyright (C) 2009 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: combinators io io.files io.files.links io.directories -io.pathnames io.streams.string kernel math math.parser -continuations namespaces pack prettyprint sequences strings -system tools.hexdump io.encodings.binary summary accessors -io.backend byte-arrays io.streams.byte-array splitting ; +USING: accessors byte-arrays combinators io io.backend +io.directories io.encodings.binary io.files io.files.links +io.pathnames io.streams.byte-array io.streams.string kernel +math math.parser namespaces sequences strings summary ; IN: tar CONSTANT: zero-checksum 256 @@ -221,7 +220,7 @@ M: symbolic-link do-link ! FIXME: linux tar calls unlinkat and makelinkat : make-links ( -- ) to-link get [ - [ [ name>> delete-file ] [ 2drop ] recover ] [ do-link ] bi + [ name>> ?delete-file ] [ do-link ] bi ] each ; : untar ( path -- )