factor/library/io/files.facts

56 lines
2.4 KiB
Plaintext
Raw Normal View History

2006-01-16 02:48:15 -05:00
USING: help io ;
HELP: cwd "( -- path )"
{ $values { "path" "a pathname string" } }
{ $description "Outputs the current working directory of the Factor process." }
{ $see-also cd } ;
HELP: cd "( path -- )"
{ $values { "path" "a pathname string" } }
{ $description "Changes the current working directory of the Factor process." }
{ $see-also cwd } ;
HELP: stat "( path -- array/f )"
{ $values { "path" "a pathname string" } { "array/f" "a four-element array or " { $link f } } }
{ $description
"If the file does not exist, outputs " { $link f } ". Otherwise, outputs a four-element array:"
{ $list
"boolean indicating if the file is a directory"
"the length in bytes as an integer"
"a Unix permission bitmap (0 on Windows)"
"the last modification time, as milliseconds since midnight, January 1st 1970 GMT"
}
} ;
2006-01-16 02:48:15 -05:00
HELP: path+ "( str1 str2 -- str )"
{ $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } }
{ $description "Concatenates two path names." } ;
HELP: exists? "( path -- ? )"
{ $values { "path" "a string" } { "?" "a boolean" } }
{ $description "Tests if the file named by " { $snippet "path" } " exists." } ;
HELP: directory? "( path -- ? )"
{ $values { "path" "a string" } { "?" "a boolean" } }
{ $description "Tests if " { $snippet "path" } " names a directory." } ;
HELP: directory "( path -- seq )"
{ $values { "path" "a string" } { "seq" "a sequence of file name strings" } }
{ $description "Outputs a sorted sequence of file names stored in the directory named by " { $snippet "path" } "." } ;
HELP: file-length "( path -- n )"
{ $values { "path" "a 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." } ;
HELP: resource-path "( resource -- path )"
{ $values { "resource" "a string" } { "path" "a string" } }
{ $description "Resolve a path relative to the Factor source code location." } ;
HELP: <resource-reader> "( resource -- stream )"
2006-01-16 02:48:15 -05:00
{ $values { "resource" "a string" } { "stream" "an input stream" } }
{ $description "Opens a file relative to the Factor source code location." } ;
HELP: directory. "( path -- )"
{ $values { "path" "a string" } }
{ $description "Prints a directory listing to the " { $link stdio } " stream. If the stream supports it, subdirectories are shown as expandable outliners." } ;