X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=core%2Fio%2Ffiles%2Ffiles.factor;fp=core%2Fio%2Ffiles%2Ffiles.factor;h=4a68452a6b0ee211c7f075f4d6af388619290147;hp=c67c8e2e65c78d9c07562ad7d11fd47ad37e059c;hb=a259c0f4dbcb72ff726d0d6808a8b8f602700bab;hpb=cefa1516a76e64ee32a9a96bf3f4cf2fb8e6ac51 diff --git a/core/io/files/files.factor b/core/io/files/files.factor index c67c8e2e65..4a68452a6b 100644 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -30,6 +30,8 @@ HOOK: (file-reader) io-backend ( path -- stream ) HOOK: (file-writer) io-backend ( path -- stream ) +HOOK: (file-writer-secure) io-backend ( path -- stream ) + HOOK: (file-appender) io-backend ( path -- stream ) : ( path encoding -- stream ) @@ -38,6 +40,9 @@ HOOK: (file-appender) io-backend ( path -- stream ) : ( path encoding -- stream ) [ normalize-path (file-writer) { file-writer } declare ] dip ; inline +: ( path encoding -- stream ) + [ normalize-path (file-writer-secure) { file-writer } declare ] dip ; inline + : ( path encoding -- stream ) [ normalize-path (file-appender) { file-writer } declare ] dip ; inline @@ -53,6 +58,9 @@ HOOK: (file-appender) io-backend ( path -- stream ) : with-file-writer ( path encoding quot -- ) [ ] dip with-output-stream ; inline +: with-file-writer-secure ( path encoding quot -- ) + [ ] dip with-output-stream ; inline + : set-file-lines ( seq path encoding -- ) [ [ print ] each ] with-file-writer ;