2012-10-24 19:44:12 -04:00
USING: arrays help.markup help.syntax kernel io.files ;
2008-12-14 21:03:00 -05:00
IN: io.files.info
HELP: file-info
{ $values { "path" "a pathname string" } { "info" file-info } }
{ $description "Queries the file system for metadata. If " { $snippet "path" } " refers to a symbolic link, it is followed. See the article " { $link "file-types" } " for a list of metadata symbols." }
{ $errors "Throws an error if the file does not exist." } ;
HELP: link-info
{ $values { "path" "a pathname string" } { "info" "a file-info tuple" } }
{ $description "Queries the file system for metadata. If path refers to a symbolic link, information about the symbolic link itself is returned. If the file does not exist, an exception is thrown." } ;
{ file-info link-info } related-words
HELP: directory?
2014-05-23 23:20:15 -04:00
{ $values { "file-info" file-info } { "?" boolean } }
2008-12-14 21:03:00 -05:00
{ $description "Tests if " { $snippet "file-info" } " is a directory." } ;
2013-04-18 12:59:07 -04:00
HELP: regular-file?
2014-05-23 23:20:15 -04:00
{ $values { "file-info" file-info } { "?" boolean } }
2013-04-18 12:59:07 -04:00
{ $description "Tests if " { $snippet "file-info" } " is a normal file." } ;
2013-04-18 10:35:47 -04:00
2013-04-18 12:59:07 -04:00
HELP: symbolic-link?
2014-05-23 23:20:15 -04:00
{ $values { "file-info" file-info } { "?" boolean } }
2013-04-18 12:59:07 -04:00
{ $description "Tests if " { $snippet "file-info" } " is a symbolic link." } ;
2013-04-18 10:35:47 -04:00
2008-12-14 21:03:00 -05:00
HELP: file-systems
{ $values { "array" array } }
{ $description "Returns an array of " { $link file-system-info } " objects returned by iterating the mount points and calling " { $link file-system-info } " on each." } ;
HELP: file-system-info
{ $values
{ "path" "a pathname string" }
{ "file-system-info" file-system-info } }
2010-09-11 21:21:18 -04:00
{ $description "Returns a platform-specific object describing the file-system that contains the path. The cross-platform slot is " { $slot "free-space" } "." }
{ $examples
{ $unchecked-example
"USING: io.files.info io.pathnames math prettyprint ;"
"IN: scratchpad"
""
": gb ( m -- n ) 30 2^ * ;"
""
"home file-system-info free-space>> 100 gb < ."
"f"
}
} ;
2008-12-14 21:03:00 -05:00
2012-10-24 19:44:12 -04:00
HELP: file-readable?
{ $values { "path" "a pathname string" } { "?" boolean } }
2012-10-24 20:39:19 -04:00
{ $description "Returns whether the file specified by " { $snippet "path" } " is readable by the current process." }
{ $errors "Throws an error if the file does not exist." } ;
2012-10-24 19:44:12 -04:00
HELP: file-writable?
{ $values { "path" "a pathname string" } { "?" boolean } }
2012-10-24 20:39:19 -04:00
{ $description "Returns whether the file specified by " { $snippet "path" } " is writable by the current process." }
{ $errors "Throws an error if the file does not exist." } ;
2012-10-24 19:44:12 -04:00
HELP: file-executable?
{ $values { "path" "a pathname string" } { "?" boolean } }
2012-10-24 20:39:19 -04:00
{ $description "Returns whether the file specified by " { $snippet "path" } " is executable by the current process." }
{ $errors "Throws an error if the file does not exist." } ;
2012-10-24 19:44:12 -04:00
2008-12-14 21:03:00 -05:00
ARTICLE: "io.files.info" "File system meta-data"
"File meta-data:"
2009-10-01 15:56:36 -04:00
{ $subsections
file-info
link-info
exists?
directory?
2013-04-18 12:59:07 -04:00
regular-file?
symbolic-link?
2009-10-01 15:56:36 -04:00
}
2008-12-14 21:03:00 -05:00
"File types:"
2009-10-01 15:56:36 -04:00
{ $subsections "file-types" }
2008-12-14 21:03:00 -05:00
"File system meta-data:"
2009-10-01 15:56:36 -04:00
{ $subsections
file-system-info
file-systems
2012-10-24 19:44:12 -04:00
}
"File permissions:"
{ $subsections
file-readable?
file-writable?
file-executable?
2009-10-01 15:56:36 -04:00
} ;
2008-12-14 21:03:00 -05:00
ABOUT: "io.files.info"