| 86 | // |
| 87 | |
| 88 | PathName TempFile::getTempPath() |
| 89 | { |
| 90 | const char* env_temp = getenv(ENV_VAR); |
| 91 | PathName path = env_temp ? env_temp : ""; |
| 92 | if (path.empty()) |
| 93 | { |
| 94 | #if defined(WIN_NT) |
| 95 | char temp_dir[MAXPATHLEN]; |
| 96 | // this checks "TEMP" and "TMP" environment variables |
| 97 | const int len = GetTempPath(sizeof(temp_dir), temp_dir); |
| 98 | if (len && len < sizeof(temp_dir)) |
| 99 | { |
| 100 | path = temp_dir; |
| 101 | } |
| 102 | #else |
| 103 | env_temp = getenv("TMP"); |
| 104 | path = env_temp ? env_temp : ""; |
| 105 | #endif |
| 106 | } |
| 107 | if (path.empty()) |
| 108 | { |
| 109 | const char* tmp = getTemporaryFolder(); |
| 110 | if (tmp) |
| 111 | path = tmp; |
| 112 | else |
| 113 | path = DEFAULT_PATH; |
| 114 | } |
| 115 | |
| 116 | fb_assert(path.length()); |
| 117 | return path; |
| 118 | } |
| 119 | |
| 120 | // |
| 121 | // TempFile::create |
nothing calls this directly
no test coverage detected