Deleting duplication in files
parent
efb3367c45
commit
1764f8671b
|
@ -6,10 +6,6 @@ system combinators splitting sbufs continuations io.encodings
|
||||||
io.encodings.binary ;
|
io.encodings.binary ;
|
||||||
IN: io.files
|
IN: io.files
|
||||||
|
|
||||||
HOOK: cd io-backend ( path -- )
|
|
||||||
|
|
||||||
HOOK: cwd io-backend ( -- path )
|
|
||||||
|
|
||||||
HOOK: (file-reader) io-backend ( path -- stream )
|
HOOK: (file-reader) io-backend ( path -- stream )
|
||||||
|
|
||||||
HOOK: (file-writer) io-backend ( path -- stream )
|
HOOK: (file-writer) io-backend ( path -- stream )
|
||||||
|
@ -25,14 +21,8 @@ HOOK: (file-appender) io-backend ( path -- stream )
|
||||||
: <file-appender> ( path encoding -- stream )
|
: <file-appender> ( path encoding -- stream )
|
||||||
swap (file-appender) swap <encoder> ;
|
swap (file-appender) swap <encoder> ;
|
||||||
|
|
||||||
HOOK: delete-file io-backend ( path -- )
|
|
||||||
|
|
||||||
HOOK: rename-file io-backend ( from to -- )
|
HOOK: rename-file io-backend ( from to -- )
|
||||||
|
|
||||||
HOOK: make-directory io-backend ( path -- )
|
|
||||||
|
|
||||||
HOOK: delete-directory io-backend ( path -- )
|
|
||||||
|
|
||||||
! Pathnames
|
! Pathnames
|
||||||
: path-separator? ( ch -- ? ) windows? "/\\" "/" ? member? ;
|
: path-separator? ( ch -- ? ) windows? "/\\" "/" ? member? ;
|
||||||
|
|
||||||
|
@ -215,14 +205,6 @@ DEFER: copy-tree-to
|
||||||
: resource-exists? ( path -- ? )
|
: resource-exists? ( path -- ? )
|
||||||
?resource-path exists? ;
|
?resource-path exists? ;
|
||||||
|
|
||||||
: temp-directory ( -- path )
|
|
||||||
"temp" resource-path
|
|
||||||
dup exists? not
|
|
||||||
[ dup make-directory ]
|
|
||||||
when ;
|
|
||||||
|
|
||||||
: temp-file ( name -- path ) temp-directory swap path+ ;
|
|
||||||
|
|
||||||
! Pathname presentations
|
! Pathname presentations
|
||||||
TUPLE: pathname string ;
|
TUPLE: pathname string ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue