Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2008-03-13 04:29:39 -05:00
commit 96c4aaf94a
4 changed files with 11 additions and 7 deletions

View File

@ -55,7 +55,7 @@ ARTICLE: "fs-meta" "File meta-data"
{ $subsection link-info } { $subsection link-info }
{ $subsection exists? } { $subsection exists? }
{ $subsection directory? } { $subsection directory? }
{ $subsection file-modified } ! { $subsection file-modified }
{ $subsection stat } ; { $subsection stat } ;
ARTICLE: "delete-move-copy" "Deleting, moving, copying files" 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." "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+ HELP: path+
{ $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } } { $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" } "." } { $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." } ; { $notes "Unlike " { $link directory } ", this word prepends the directory's path to all file names in the list." } ;
HELP: file-modified ! HELP: file-modified
{ $values { "path" "a pathname string" } { "n" "a non-negative integer or " { $link f } } } ! { $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 } "." } ; ! { $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 HELP: resource-path
{ $values { "path" "a pathname string" } { "newpath" "a pathname string" } } { $values { "path" "a pathname string" } { "newpath" "a pathname string" } }

View File

@ -219,6 +219,9 @@ M: pathname <=> [ pathname-string ] compare ;
: with-file-reader ( path encoding quot -- ) : with-file-reader ( path encoding quot -- )
>r <file-reader> r> with-stream ; inline >r <file-reader> r> with-stream ; inline
! : file-contents ( path encoding -- str )
! dupd [ file-info file-info-size read ] with-file-reader ;
: file-contents ( path encoding -- str ) : file-contents ( path encoding -- str )
dupd [ file-length read ] with-file-reader ; dupd [ file-length read ] with-file-reader ;

View File

@ -68,7 +68,7 @@ M: unix-io delete-directory ( path -- )
] with-disposal ; ] with-disposal ;
M: unix-io copy-file ( from to -- ) 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>type ( stat -- type )
stat-st_mode { stat-st_mode {

View File

@ -4,6 +4,7 @@ USING: alien alien.accessors alien.c-types arrays io kernel libc
math math.vectors namespaces opengl opengl.gl prettyprint assocs math math.vectors namespaces opengl opengl.gl prettyprint assocs
sequences io.files io.styles continuations freetype sequences io.files io.styles continuations freetype
ui.gadgets.worlds ui.render ui.backend byte-arrays ; ui.gadgets.worlds ui.render ui.backend byte-arrays ;
IN: ui.freetype IN: ui.freetype
TUPLE: freetype-renderer ; TUPLE: freetype-renderer ;
@ -74,7 +75,7 @@ M: freetype-renderer free-fonts ( world -- )
: open-face ( font style -- face ) : open-face ( font style -- face )
ttf-name ttf-path ttf-name ttf-path
dup malloc-file-contents dup malloc-file-contents
swap file-length swap file-info file-info-size
(open-face) ; (open-face) ;
SYMBOL: dpi SYMBOL: dpi