]> gitweb.factorcode.org Git - factor.git/commitdiff
io.files.info: Add file? and symlink? words.
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 18 Apr 2013 14:35:47 +0000 (07:35 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 18 Apr 2013 14:35:47 +0000 (07:35 -0700)
basis/io/files/info/info-docs.factor
basis/io/files/info/info.factor

index 98d05bab6f72921d97ceac92bce62729c4fa6f8a..6c608e71d8224c3ac8794516ca0649f63aefa61b 100644 (file)
@@ -16,6 +16,14 @@ HELP: directory?
 { $values { "file-info" file-info } { "?" "a boolean" } }
 { $description "Tests if " { $snippet "file-info" } " is a directory." } ;
 
+HELP: file?
+{ $values { "file-info" file-info } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "file-info" } " is a file." } ;
+
+HELP: symlink?
+{ $values { "file-info" file-info } { "?" "a boolean" } }
+{ $description "Tests if " { $snippet "file-info" } " is a symlink." } ;
+
 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." } ;
@@ -59,6 +67,8 @@ ARTICLE: "io.files.info" "File system meta-data"
     link-info
     exists?
     directory?
+    file?
+    symlink?
 }
 "File types:"
 { $subsections "file-types" }
index 38e807b02a84b2e89c02c788a391baae690ff905..23a271ba618d096fe96b52f9049145ba231523da 100644 (file)
@@ -13,6 +13,8 @@ HOOK: file-info os ( path -- info )
 HOOK: link-info os ( path -- info )
 
 : directory? ( file-info -- ? ) type>> +directory+ = ;
+: file? ( file-info -- ? ) type>> +regular-file+ = ;
+: symlink? ( file-info -- ? ) type>> +symbolic-link+ = ;
 
 : sparse-file? ( file-info -- ? )
     [ size-on-disk>> ] [ size>> ] bi < ;