summaryrefslogtreecommitdiff
path: root/lib/std/syswrap+posixy.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-11-19 23:01:53 -0800
committerOri Bernstein <ori@eigenstate.org>2015-11-20 18:27:05 -0800
commitb558899eeecc4e42a9333d61ba0eeaec662a4b8b (patch)
treedae98173bd12995cbb07e00d22cf7ee2f945f9f5 /lib/std/syswrap+posixy.myr
parentf767b929dbc86ff9f0fb637d6c7cdfeb20883521 (diff)
downloadmc-b558899eeecc4e42a9333d61ba0eeaec662a4b8b.tar.gz
Add fisdir() call to libstd.
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 6dea9c5..715e331 100644
--- a/lib/std/syswrap+posixy.myr
+++ b/lib/std/syswrap+posixy.myr
@@ -47,6 +47,7 @@ pkg std =
const fmtime : (f : byte[:] -> result(time, errno))
const fsize : (f : byte[:] -> result(off, errno))
const fexists : (f : byte[:] -> bool)
+ const fisdir : (f : byte[:] -> bool)
/* useful/portable bits of uname */
const getsysinfo : (si : sysinfo# -> void)
@@ -125,6 +126,16 @@ const fexists = {path
-> sys.stat(path, &sb) == 0
}
+const fisdir = {path
+ var sb
+
+ if sys.stat(path, &sb) >= 0
+ -> sb.mode & sys.Sifdir != 0
+ else
+ -> false
+ ;;
+}
+
const fmtime = {path
var sb, r
var sec, nsec