Closed danfe closed 1 year ago
On Windows, it's probably safe to assume that TEMP environment variable is always there and set, but on Unix-like systems it is not, and when it is, it's typically named TMP. Consider the following patch:
TEMP
TMP
@@ -1758,7 +1758,11 @@ public static string GetTempDir() { - string tempPath = Environment.GetEnvironmentVariable("TEMP"); + string tempPath; + if (SysUtils.IsUnix()) + tempPath = Environment.GetEnvironmentVariable("TMP") ?? "/tmp"; + else + tempPath = Environment.GetEnvironmentVariable("TEMP"); return tempPath + Path.DirectorySeparatorChar; }
More correct and cross-platform way would be to use Path.GetTempPath()
Path.GetTempPath()
On Windows, it's probably safe to assume that
TEMP
environment variable is always there and set, but on Unix-like systems it is not, and when it is, it's typically namedTMP
. Consider the following patch: