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