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 cbb6e77ff9..8a81bb1972 100755 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -219,6 +219,9 @@ 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-length read ] with-file-reader ; 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 { diff --git a/extra/ui/freetype/freetype.factor b/extra/ui/freetype/freetype.factor index 8078ec4a33..8dca72c29e 100755 --- a/extra/ui/freetype/freetype.factor +++ b/extra/ui/freetype/freetype.factor @@ -4,6 +4,7 @@ USING: alien alien.accessors alien.c-types arrays io kernel libc math math.vectors namespaces opengl opengl.gl prettyprint assocs sequences io.files io.styles continuations freetype ui.gadgets.worlds ui.render ui.backend byte-arrays ; + IN: ui.freetype TUPLE: freetype-renderer ; @@ -74,7 +75,7 @@ M: freetype-renderer free-fonts ( world -- ) : open-face ( font style -- face ) ttf-name ttf-path dup malloc-file-contents - swap file-length + swap file-info file-info-size (open-face) ; SYMBOL: dpi