X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Fbasis%2Fenvironment.cpp;h=520b7791c11f4739cd763022c6e3e0be9fde0022;hb=51b587223136de70cd5a9f1cfbf2bf80b4e70ba0;hp=5e50abfbe861913a7fe7d6230a672cff7b5bddfd;hpb=3ea085ec301ed1399dfa1e9f3a240312dc95410b;p=feisty_meow.git diff --git a/nucleus/library/basis/environment.cpp b/nucleus/library/basis/environment.cpp index 5e50abfb..520b7791 100644 --- a/nucleus/library/basis/environment.cpp +++ b/nucleus/library/basis/environment.cpp @@ -29,6 +29,24 @@ 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 + if (!!to_return) set("TMP", to_return); + } + return to_return; +} + astring environment::get(const astring &variable_name) { #ifdef __WIN32__