diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-01-13 14:33:32 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2022-01-13 14:33:32 +0200 |
commit | 4939987a151da2ad81e6c2b42876f03c8ad09eb5 (patch) | |
tree | 7ff4a0b36e8405cfe0b0b216c10cb426f61c637f /src | |
parent | 7251a904f8a37a2e94b459f4aa8f10f71c85fa2f (diff) |
App: Better way to determine directory for temporary files
Diffstat (limited to 'src')
-rw-r--r-- | src/app.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1109,8 +1109,13 @@ const iString *downloadPathForUrl_App(const iString *url, const iString *mime) { | |||
1109 | 1109 | ||
1110 | const iString *temporaryPathForUrl_App(const iString *url, const iString *mime) { | 1110 | const iString *temporaryPathForUrl_App(const iString *url, const iString *mime) { |
1111 | iApp *d = &app_; | 1111 | iApp *d = &app_; |
1112 | iString *tmpPath = collectNewCStr_String(tmpnam(NULL)); | 1112 | #if defined (P_tmpdir) |
1113 | iString * tmpPath = collectNew_String(); | ||
1114 | const iRangecc tmpDir = range_CStr(P_tmpdir); | ||
1115 | #else | ||
1116 | iString * tmpPath = collectNewCStr_String(tmpnam(NULL)); | ||
1113 | const iRangecc tmpDir = dirName_Path(tmpPath); | 1117 | const iRangecc tmpDir = dirName_Path(tmpPath); |
1118 | #endif | ||
1114 | set_String( | 1119 | set_String( |
1115 | tmpPath, | 1120 | tmpPath, |
1116 | collect_String(concat_Path(collectNewRange_String(tmpDir), fileNameForUrl_App(url, mime)))); | 1121 | collect_String(concat_Path(collectNewRange_String(tmpDir), fileNameForUrl_App(url, mime)))); |