]> gitweb.factorcode.org Git - factor.git/blob - core/io/files.facts
6c7dd36eb1a4dc09344a58c7c2c3aa5581b67b64
[factor.git] / core / io / files.facts
1 USING: help io styles ;
2
3 HELP: cwd ( -- path )
4 { $values { "path" "a path name string" } }
5 { $description "Outputs the current working directory of the Factor process." }
6 { $see-also cd } ;
7
8 HELP: cd ( path -- )
9 { $values { "path" "a path name string" } }
10 { $description "Changes the current working directory of the Factor process." }
11 { $see-also cwd } ;
12
13 HELP: stat ( path -- directory? length permissions modified )
14 { $values { "path" "a path name string" } { "directory?" "boolean indicating if the file is a directory" } { "length" "the length in bytes as an integer" } { "permissions" "a Unix permission bitmap (0 on Windows" } { "modified" "the last modification time, as milliseconds since midnight, January 1st 1970 GMT" } }
15 { $description
16     "Queries the file system for file meta data. If the file does not exist, outputs " { $link f } " for all four values."
17 }
18 { $see-also exists? directory? file-length file-modified } ;
19
20 HELP: path+
21 { $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } }
22 { $description "Concatenates two path names." } ;
23
24 HELP: exists?
25 { $values { "path" "a string" } { "?" "a boolean" } }
26 { $description "Tests if the file named by " { $snippet "path" } " exists." } ;
27
28 HELP: directory?
29 { $values { "path" "a string" } { "?" "a boolean" } }
30 { $description "Tests if " { $snippet "path" } " names a directory." } ;
31
32 HELP: directory
33 { $values { "path" "a string" } { "seq" "a sequence of file name strings" } }
34 { $description "Outputs a sorted sequence of file names stored in the directory named by " { $snippet "path" } "." } ;
35
36 HELP: file-length
37 { $values { "path" "a string" } { "n" "a non-negative integer or " { $link f } } }
38 { $description "Outputs the length of the file in bytes, or " { $link f } " if it does not exist." } ;
39
40 HELP: parent-dir
41 { $values { "path" "a string" } { "parent" "a string" } }
42 { $description "Strips the last component off a path name." }
43 { $examples { $example "\"/etc/passwd\" parent-dir print" "/etc" } } ;
44
45 HELP: resource-path
46 { $values { "resource" "a string" } { "path" "a string" } }
47 { $description "Resolve a path relative to the Factor source code location. This first checks if the " { $link resource-path } " variable is set to a path, and if not, uses the parent directory of the current image." } ;
48
49 HELP: pathname
50 { $class-description "Class of path name presentations. Instances can be used passed to " { $link write-object } " to output a clickable path name." } ;