ref: 38941f5eadd5e3606776d3c0004b997fb53ba399
parent: 73c618bf4af5f96b4d1c0790662b6bd9e0a1f33e
author: Ori Bernstein <[email protected]>
date: Sun Sep 10 15:11:29 EDT 2017
Add `tmpdir` function.
--- a/lib/fileutil/bld.sub
+++ b/lib/fileutil/bld.sub
@@ -1,6 +1,7 @@
lib fileutil =
walk.myr
homedir.myr
+ tmpdir.myr
lib ../sys:sys
lib ../std:std
--- /dev/null
+++ b/lib/fileutil/tmpdir.myr
@@ -1,0 +1,12 @@
+use std
+
+pkg fileutil =
+ const homedir : (-> byte[:])
+;;
+
+const homedir = {
+ match std.getenv("TMPDIR")
+ | `std.Some h: -> d
+ | `std.None: -> "/tmp"
+ ;;
+}