1 USING: help.markup help.syntax io.backend io.files strings ;
5 { $values { "ch" "a code point" } { "?" "a boolean" } }
6 { $description "Tests if the code point is a platform-specific path separator." }
9 { $example "USING: io.files prettyprint ;" "CHAR: / path-separator? ." "t" }
12 HELP: parent-directory
13 { $values { "path" "a pathname string" } { "parent" "a pathname string" } }
14 { $description "Strips the last component off a pathname." }
15 { $examples { $example "USING: io io.files ;" "\"/etc/passwd\" parent-directory print" "/etc/" } } ;
18 { $values { "path" "a pathname string" } { "string" string } }
19 { $description "Outputs the last component of a pathname string." }
21 { $example "USING: io.files prettyprint ;" "\"/usr/bin/gcc\" file-name ." "\"gcc\"" }
22 { $example "USING: io.files prettyprint ;" "\"/usr/libexec/awk/\" file-name ." "\"awk\"" }
26 { $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } }
27 { $description "Appends " { $snippet "str1" } " and " { $snippet "str2" } " to form a pathname." } ;
30 { $values { "str1" "a string" } { "str2" "a string" } { "str" "a string" } }
31 { $description "Appends " { $snippet "str2" } " and " { $snippet "str1" } " to form a pathname." } ;
33 { append-path prepend-path } related-words
36 { $values { "path" "a pathname string" } { "?" "a boolean" } }
37 { $description "Tests if a pathname is absolute. Examples of absolute pathnames are " { $snippet "/foo/bar" } " on Unix and " { $snippet "c:\\foo\\bar" } " on Windows." } ;
39 HELP: windows-absolute-path?
40 { $values { "path" "a pathname string" } { "?" "a boolean" } }
41 { $description "Tests if a pathname is absolute on Windows. Examples of absolute pathnames on Windows are " { $snippet "c:\\foo\\bar" } " and " { $snippet "\\\\?\\c:\\foo\\bar" } " for absolute Unicode pathnames." } ;
44 { $values { "path" "a pathname string" } { "?" "a boolean" } }
45 { $description "Tests if a pathname is a root directory. Examples of root directory pathnames are " { $snippet "/" } " on Unix and " { $snippet "c:\\" } " on Windows." } ;
47 { absolute-path? windows-absolute-path? root-directory? } related-words
50 { $values { "path" "a pathname string" } { "newpath" "a pathname string" } }
51 { $description "Resolve a path relative to the Factor source code location." } ;
54 { $class-description "Class of path name objects. Path name objects can be created by calling " { $link <pathname> } "." } ;
57 { $values { "str" "a pathname string" } { "newstr" "a new pathname string" } }
58 { $description "Called by words such as " { $link <file-reader> } " and " { $link <file-writer> } " to prepare a pathname before passing it to underlying code." } ;
60 HELP: <pathname> ( str -- pathname )
61 { $values { "str" "a pathname string" } { "pathname" pathname } }
62 { $description "Creates a new " { $link pathname } "." } ;
65 { $values { "dir" string } }
66 { $description "Outputs the user's home directory." } ;
68 ARTICLE: "pathnames" "Pathname manipulation"
69 "Pathname manipulation:"
70 { $subsection parent-directory }
71 { $subsection file-name }
72 { $subsection last-path-separator }
73 { $subsection append-path }
74 "Pathname presentations:"
75 { $subsection pathname }
76 { $subsection <pathname> } ;