ref: b558899eeecc4e42a9333d61ba0eeaec662a4b8b
parent: f767b929dbc86ff9f0fb637d6c7cdfeb20883521
author: Ori Bernstein <[email protected]>
date: Thu Nov 19 18:01:53 EST 2015
Add fisdir() call to libstd.
--- a/lib/std/syswrap+posixy.myr
+++ b/lib/std/syswrap+posixy.myr
@@ -47,6 +47,7 @@
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)
@@ -123,6 +124,16 @@
var sb
-> 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