From 3929d02f17c83fe5a43ec29c3c6cf62e0f71d89a Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Thu, 13 Mar 2008 04:19:32 -0600 Subject: [PATCH] Fix a couple of problems preventing bootstrap --- core/io/files/files-docs.factor | 10 +++++----- core/io/files/files.factor | 5 ++++- extra/io/unix/files/files.factor | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/io/files/files-docs.factor b/core/io/files/files-docs.factor index a6dd1e0818..df9c78fe47 100755 --- a/core/io/files/files-docs.factor +++ b/core/io/files/files-docs.factor @@ -55,7 +55,7 @@ ARTICLE: "fs-meta" "File meta-data" { $subsection link-info } { $subsection exists? } { $subsection directory? } -{ $subsection file-modified } +! { $subsection file-modified } { $subsection stat } ; ARTICLE: "delete-move-copy" "Deleting, moving, copying files" @@ -222,7 +222,7 @@ HELP: stat ( path -- directory? permissions length modified ) "Queries the file system for file meta data. If the file does not exist, outputs " { $link f } " for all four values." } ; -{ stat exists? directory? file-modified } related-words +{ stat exists? directory? } related-words HELP: path+ { $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } } @@ -250,9 +250,9 @@ HELP: directory* { $description "Outputs the contents of a directory named by " { $snippet "path" } "." } { $notes "Unlike " { $link directory } ", this word prepends the directory's path to all file names in the list." } ; -HELP: file-modified -{ $values { "path" "a pathname string" } { "n" "a non-negative integer or " { $link f } } } -{ $description "Outputs a file's last modification time, since midnight January 1, 1970. If the file does not exist, outputs " { $link f } "." } ; +! HELP: file-modified +! { $values { "path" "a pathname string" } { "n" "a non-negative integer or " { $link f } } } +! { $description "Outputs a file's last modification time, since midnight January 1, 1970. If the file does not exist, outputs " { $link f } "." } ; HELP: resource-path { $values { "path" "a pathname string" } { "newpath" "a pathname string" } } diff --git a/core/io/files/files.factor b/core/io/files/files.factor index 104c38518a..8a81bb1972 100755 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -219,8 +219,11 @@ M: pathname <=> [ pathname-string ] compare ; : with-file-reader ( path encoding quot -- ) >r r> with-stream ; inline +! : file-contents ( path encoding -- str ) +! dupd [ file-info file-info-size read ] with-file-reader ; + : file-contents ( path encoding -- str ) - dupd [ file-info file-info-size read ] with-file-reader ; + dupd [ file-length read ] with-file-reader ; : with-file-writer ( path encoding quot -- ) >r r> with-stream ; inline diff --git a/extra/io/unix/files/files.factor b/extra/io/unix/files/files.factor index 73090ea724..bdcd0b985d 100755 --- a/extra/io/unix/files/files.factor +++ b/extra/io/unix/files/files.factor @@ -68,7 +68,7 @@ M: unix-io delete-directory ( path -- ) ] with-disposal ; M: unix-io copy-file ( from to -- ) - [ (copy-file) ] 2keep swap file-permissions chmod io-error ; + [ (copy-file) ] 2keep swap file-info file-info-permissions io-error ; : stat>type ( stat -- type ) stat-st_mode {