]> gitweb.factorcode.org Git - factor.git/commitdiff
io.directories: defining "?delete-file".
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 25 Oct 2012 17:07:15 +0000 (10:07 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 25 Oct 2012 17:07:15 +0000 (10:07 -0700)
basis/io/directories/directories.factor
basis/vocabs/metadata/metadata.factor
extra/tar/tar.factor

index 084facc21b86c0baba09d34f447e29f89d01bb3b..eb656be6b4f5f5656da670318cad48ac485f18cd 100644 (file)
@@ -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 ;
 
index 9b144fd31709f2484a716bb7359d6845474f16c5..b09068e1ea412dae817146fae37766ab1f769492 100644 (file)
@@ -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
index 09db6b2e63ead9add7d836057f5a1762bed41a79..e56f39800836cd5e239c9851cc8c43db5c170a5d 100644 (file)
@@ -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 -- )