try first storing the temporary file in user directory,

only then in current directory
This commit is contained in:
Holger Vogt 2020-05-13 22:14:52 +02:00
parent 80ad645b49
commit 02fdcaff2d
1 changed files with 8 additions and 1 deletions

View File

@ -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());
}