cleaning up usage of TMP variable to always get it from environment class.
[feisty_meow.git] / nucleus / library / basis / environment.cpp
index 5e50abfbe861913a7fe7d6230a672cff7b5bddfd..907c8504b809d3421139fa0c582193ab52d7b7c1 100644 (file)
 
 namespace basis {
 
+astring environment::TMP()
+{
+  const static astring TMP_VARIABLE_NAME("TMP");
+  astring to_return = get(TMP_VARIABLE_NAME);
+  if (!to_return) {
+    // they did not see fit to set this in the environment.  let's make something up.
+#ifdef __WIN32__
+    // windows default does not necessarily exist.
+    to_return = "c:/tmp";
+#else
+    // most reasonable OSes have a /tmp directory.
+    to_return = "/tmp";
+#endif
+  }
+  return to_return;
+}
+
 astring environment::get(const astring &variable_name)
 {
 #ifdef __WIN32__