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:"
[ 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