]> gitweb.factorcode.org Git - factor.git/blobdiff - core/io/files/files.factor
io.files: implement (file-writer-secure)
[factor.git] / core / io / files / files.factor
index c67c8e2e65c78d9c07562ad7d11fd47ad37e059c..4a68452a6b0ee211c7f075f4d6af388619290147 100644 (file)
@@ -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 )
 
 : <file-reader> ( path encoding -- stream )
@@ -38,6 +40,9 @@ HOOK: (file-appender) io-backend ( path -- stream )
 : <file-writer> ( path encoding -- stream )
     [ normalize-path (file-writer) { file-writer } declare ] dip <encoder> ; inline
 
+: <file-writer-secure> ( path encoding -- stream )
+    [ normalize-path (file-writer-secure) { file-writer } declare ] dip <encoder> ; inline
+
 : <file-appender> ( path encoding -- stream )
     [ normalize-path (file-appender) { file-writer } declare ] dip <encoder> ; inline
 
@@ -53,6 +58,9 @@ HOOK: (file-appender) io-backend ( path -- stream )
 : with-file-writer ( path encoding quot -- )
     [ <file-writer> ] dip with-output-stream ; inline
 
+: with-file-writer-secure ( path encoding quot -- )
+    [ <file-writer-secure> ] dip with-output-stream ; inline
+
 : set-file-lines ( seq path encoding -- )
     [ [ print ] each ] with-file-writer ;