From 4939987a151da2ad81e6c2b42876f03c8ad09eb5 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Thu, 13 Jan 2022 14:33:32 +0200 Subject: App: Better way to determine directory for temporary files --- src/app.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app.c b/src/app.c index 65f6fde6..229fde75 100644 --- a/src/app.c +++ b/src/app.c @@ -1109,8 +1109,13 @@ const iString *downloadPathForUrl_App(const iString *url, const iString *mime) { const iString *temporaryPathForUrl_App(const iString *url, const iString *mime) { iApp *d = &app_; - iString *tmpPath = collectNewCStr_String(tmpnam(NULL)); +#if defined (P_tmpdir) + iString * tmpPath = collectNew_String(); + const iRangecc tmpDir = range_CStr(P_tmpdir); +#else + iString * tmpPath = collectNewCStr_String(tmpnam(NULL)); const iRangecc tmpDir = dirName_Path(tmpPath); +#endif set_String( tmpPath, collect_String(concat_Path(collectNewRange_String(tmpDir), fileNameForUrl_App(url, mime)))); -- cgit v1.2.3