io.files-docs: add some file-info docs

db4
Eduardo Cavazos 2008-03-13 01:43:30 -06:00
parent 4398458248
commit d5572b6218
1 changed files with 32 additions and 9 deletions

View File

@ -1,5 +1,5 @@
USING: help.markup help.syntax io io.styles strings USING: help.markup help.syntax io io.styles strings calendar
io.backend io.files.private quotations ; io.backend io.files.private quotations ;
IN: io.files IN: io.files
ARTICLE: "file-streams" "Reading and writing files" ARTICLE: "file-streams" "Reading and writing files"
@ -43,12 +43,18 @@ ARTICLE: "directories" "Directories"
{ $subsection make-directory } { $subsection make-directory }
{ $subsection make-directories } ; { $subsection make-directories } ;
! ARTICLE: "file-types" "File Types"
! { $table { +directory+ "" } }
! ;
ARTICLE: "fs-meta" "File meta-data" ARTICLE: "fs-meta" "File meta-data"
{ $subsection file-info } { $subsection file-info }
{ $subsection link-info } { $subsection link-info }
{ $subsection exists? } { $subsection exists? }
{ $subsection directory? } { $subsection directory? }
{ $subsection file-length }
{ $subsection file-modified } { $subsection file-modified }
{ $subsection stat } ; { $subsection stat } ;
@ -119,11 +125,26 @@ HELP: file-name
! need a $class-description file-info ! need a $class-description file-info
HELP: file-info HELP: file-info
{ $values { "path" "a pathname string" } { $values { "path" "a pathname string" }
{ "info" "a file-info tuple" } } { "info" file-info } }
{ $description "Queries the file system for meta data. " { $description "Queries the file system for meta data. "
"If path refers to a symbolic link, it is followed." "If path refers to a symbolic link, it is followed."
"If the file does not exist, an exception is thrown." } ; "If the file does not exist, an exception is thrown." }
{ $class-description "File meta data" }
{ $table
{ "type" { "One of the following:"
{ $list { $link +regular-file+ }
{ $link +directory+ }
{ $link +symbolic-link+ } } } }
{ "size" "Size of the file in bytes" }
{ "modified" { "Last modification " { $link timestamp } } } }
;
! need a see also to link-info ! need a see also to link-info
HELP: link-info HELP: link-info
@ -135,6 +156,8 @@ HELP: link-info
"If the file does not exist, an exception is thrown." } ; "If the file does not exist, an exception is thrown." } ;
! need a see also to file-info ! need a see also to file-info
{ file-info link-info } related-words
HELP: <file-reader> HELP: <file-reader>
{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" { "stream" "an input stream" } } { $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" { "stream" "an input stream" } }
{ "stream" "an input stream" } } { "stream" "an input stream" } }
@ -199,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-length file-modified } related-words { stat exists? directory? file-modified } 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" } }
@ -227,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-length ! HELP: file-length
{ $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 the length of the file in bytes, or " { $link f } " if it does not exist." } ; ! { $description "Outputs the length of the file in bytes, or " { $link f } " if it does not exist." } ;
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 } } }