diff --git a/src/misc/mktemp.c b/src/misc/mktemp.c index 058ddfc6e..76c89c7b4 100644 --- a/src/misc/mktemp.c +++ b/src/misc/mktemp.c @@ -25,6 +25,13 @@ smktemp(char *id) { if (!id) id = "sp"; - + const char* const home = getenv("HOME"); + if (home) { + return tprintf("%s/"TEMPFORMAT, home, id, getpid()); + } + const char* const usr = getenv("USERPROFILE"); + if (usr) { + return tprintf("%s\\"TEMPFORMAT, usr, id, getpid()); + } return tprintf(TEMPFORMAT, id, getpid()); }