]> gitweb.factorcode.org Git - factor.git/commitdiff
io.files.info: make access checks throw on file-does-not-exist.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 25 Oct 2012 00:39:19 +0000 (17:39 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 25 Oct 2012 00:40:00 +0000 (17:40 -0700)
basis/io/files/info/info-docs.factor
basis/io/files/info/unix/unix.factor

index 9b0c7a90463b84fc191ee74bb6eb3b55c7166e89..98d05bab6f72921d97ceac92bce62729c4fa6f8a 100644 (file)
@@ -39,15 +39,18 @@ HELP: file-system-info
 
 HELP: file-readable?
 { $values { "path" "a pathname string" } { "?" boolean } }
-{ $description "Returns whether the file specified by " { $snippet "path" } " exists and is readable by the current process." } ;
+{ $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." } ;
 
 HELP: file-writable?
 { $values { "path" "a pathname string" } { "?" boolean } }
-{ $description "Returns whether the file specified by " { $snippet "path" } " exists and is writable by the current process." } ;
+{ $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." } ;
 
 HELP: file-executable?
 { $values { "path" "a pathname string" } { "?" boolean } }
-{ $description "Returns whether the file specified by " { $snippet "path" } " exists and is executable by the current process." } ;
+{ $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." } ;
 
 ARTICLE: "io.files.info" "File system meta-data"
 "File meta-data:"
index 75da6d37160eb8de2a5a85899d63ea571f1425f6..a39999a0bc4c9fb5a7b6b3ae9cd54f81ef50a5fe 100644 (file)
@@ -284,8 +284,8 @@ PRIVATE>
         [ drop file-type>executable ]
     } case ;
 
-M: unix file-readable? normalize-path flags{ F_OK R_OK } access 0 = ;
-M: unix file-writable? normalize-path flags{ F_OK W_OK } access 0 = ;
-M: unix file-executable? normalize-path flags{ F_OK X_OK } access 0 = ;
+M: unix file-readable? normalize-path R_OK access io-error t ;
+M: unix file-writable? normalize-path W_OK access io-error t ;
+M: unix file-executable? normalize-path X_OK access io-error t ;
 
 "io.files.info.unix." os name>> append require