]> gitweb.factorcode.org Git - factor.git/commitdiff
file-contents and set-file-contents deal in sequences, not strings
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 29 Jan 2009 06:08:40 +0000 (00:08 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 29 Jan 2009 06:08:40 +0000 (00:08 -0600)
core/io/files/files-docs.factor
core/io/files/files-tests.factor
core/io/files/files.factor

index 263b5c19b07debc86500465cf3286b977bce22e0..cf0aea787bcc98c0cfabef70b788c8c967e64129 100644 (file)
@@ -1,5 +1,5 @@
 USING: help.markup help.syntax io strings arrays io.backend
-io.files.private quotations ;
+io.files.private quotations sequences ;
 IN: io.files
 
 ARTICLE: "io.files" "Reading and writing files"
@@ -63,13 +63,13 @@ HELP: file-lines
 { $errors "Throws an error if the file cannot be opened for reading." } ;
 
 HELP: set-file-contents
-{ $values { "str" "a string" } { "path" "a pathname string" } { "encoding" "an encoding descriptor" } }
-{ $description "Sets the contents of a file to a string with the given encoding." }
+{ $values { "seq" sequence } { "path" "a pathname string" } { "encoding" "an encoding descriptor" } }
+{ $description "Sets the contents of a file to a sequence with the given encoding." }
 { $errors "Throws an error if the file cannot be opened for writing." } ;
 
 HELP: file-contents
-{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "str" "a string" } }
-{ $description "Opens the file at the given path using the given encoding, and the contents of that file as a string." }
+{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "seq" sequence } }
+{ $description "Opens the file at the given path using the given encoding, and the contents of that file as a sequence." }
 { $errors "Throws an error if the file cannot be opened for reading." } ;
 
 { set-file-lines file-lines set-file-contents file-contents } related-words
index d2611d73a91482602793ee1b243bfaafd38691b6..f9702fd1337a993f460a29f0d6d73b8ecdf42696 100644 (file)
@@ -1,9 +1,8 @@
 USING: tools.test io.files io.files.private io.files.temp
 io.directories io.encodings.8-bit arrays make system
-io.encodings.binary io
-threads kernel continuations io.encodings.ascii sequences
-strings accessors io.encodings.utf8 math destructors namespaces
-;
+io.encodings.binary io threads kernel continuations
+io.encodings.ascii sequences strings accessors
+io.encodings.utf8 math destructors namespaces ;
 IN: io.files.tests
 
 \ exists? must-infer
index 19659ee5bb080ea4f7f83ceca1525c5d4127f482..1bc282e95661af65e6bad11a303a802926894e58 100644 (file)
@@ -25,7 +25,7 @@ HOOK: (file-appender) io-backend ( path -- stream )
 : with-file-reader ( path encoding quot -- )
     [ <file-reader> ] dip with-input-stream ; inline
 
-: file-contents ( path encoding -- str )
+: file-contents ( path encoding -- seq )
     <file-reader> contents ;
 
 : with-file-writer ( path encoding quot -- )
@@ -34,7 +34,7 @@ HOOK: (file-appender) io-backend ( path -- stream )
 : set-file-lines ( seq path encoding -- )
     [ [ print ] each ] with-file-writer ;
 
-: set-file-contents ( str path encoding -- )
+: set-file-contents ( seq path encoding -- )
     [ write ] with-file-writer ;
 
 : with-file-appender ( path encoding quot -- )
@@ -58,4 +58,4 @@ PRIVATE>
     13 getenv cwd prepend-path \ image set-global
     14 getenv cwd prepend-path \ vm set-global
     image parent-directory "resource-path" set-global
-] "io.files" add-init-hook
\ No newline at end of file
+] "io.files" add-init-hook