summaryrefslogtreecommitdiff
path: root/lib/std/syswrap+posixy.myr
diff options
context:
space:
mode:
authorandrewc <andrewchamberss@gmail.com>2016-02-11 11:30:44 +1300
committerandrewc <andrewchamberss@gmail.com>2016-02-11 11:30:44 +1300
commitdd5712495a3b7a16dcc48f93c7c9017bf79b6218 (patch)
tree9f8807498528bd3a414b0d0c064dd506ccd9bd50 /lib/std/syswrap+posixy.myr
parent5a7ad6eb2cb497076f909e54e14d42f65eb89ff9 (diff)
downloadmc-dd5712495a3b7a16dcc48f93c7c9017bf79b6218.tar.gz
stop mbld from opening a directory
Diffstat (limited to 'lib/std/syswrap+posixy.myr')
-rw-r--r--lib/std/syswrap+posixy.myr11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/std/syswrap+posixy.myr b/lib/std/syswrap+posixy.myr
index 2526208..a865100 100644
--- a/lib/std/syswrap+posixy.myr
+++ b/lib/std/syswrap+posixy.myr
@@ -48,6 +48,7 @@ pkg std =
const fsize : (f : byte[:] -> result(off, errno))
const fexists : (f : byte[:] -> bool)
const fisdir : (f : byte[:] -> bool)
+ const fisreg : (f : byte[:] -> bool)
/* useful/portable bits of uname */
const getsysinfo : (si : sysinfo# -> void)
@@ -135,6 +136,16 @@ const fisdir = {path
;;
}
+const fisreg = {path
+ var sb
+
+ if sys.stat(path, &sb) >= 0
+ -> sb.mode & sys.Sifreg != 0
+ else
+ -> false
+ ;;
+}
+
const fmtime = {path
var sb, r
var sec, nsec