summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2017-01-23 13:40:42 +0100
committerUrban Müller2017-01-23 13:40:42 +0100
commitb0f1f6067066ac5c4216672181150431270611bc (patch)
tree16be1807640ac5302a4ddf69b64536f013c43a2d
parent1479d0c37fb1953a833d6a5a4a77e957da1e3fb4 (diff)
downloaditools-b0f1f6067066ac5c4216672181150431270611bc.tar.gz
itools-b0f1f6067066ac5c4216672181150431270611bc.tar.bz2
itools-b0f1f6067066ac5c4216672181150431270611bc.zip
tempnam() with default and warnings
-rw-r--r--it.class12
1 files changed, 12 insertions, 0 deletions
diff --git a/it.class b/it.class
index 3846fe5..a9b6662 100644
--- a/it.class
+++ b/it.class
@@ -1082,4 +1082,16 @@ static function mod($a, $n)
return (($a % $n) + $n) % $n;
}
+/**
+ * Same as php tempnam() but $dir defaults to tmp/ in service home
+ */
+static function tempnam($dir, $prefix)
+{
+ $dir = $dir ?: $GLOBALS['ULTRAHOME'] . "/tmp";
+ if (!is_writable($dir))
+ it::error("tempnam: '$dir' not writable");
+
+ return tempnam($dir, $prefix);
+}
+
}