| 23 | #include "vk_layer_config.h" |
| 24 | |
| 25 | std::string GetTempFilePath() { |
| 26 | auto tmp_path = GetEnvironment("XDG_CACHE_HOME"); |
| 27 | if (!tmp_path.size()) { |
| 28 | auto cachepath = GetEnvironment("HOME") + "/.cache"; |
| 29 | struct stat info; |
| 30 | if (stat(cachepath.c_str(), &info) == 0) { |
| 31 | if ((info.st_mode & S_IFMT) == S_IFDIR) { |
| 32 | tmp_path = cachepath; |
| 33 | } |
| 34 | } |
| 35 | } |
| 36 | if (!tmp_path.size()) tmp_path = GetEnvironment("TMPDIR"); |
| 37 | if (!tmp_path.size()) tmp_path = GetEnvironment("TMP"); |
| 38 | if (!tmp_path.size()) tmp_path = GetEnvironment("TEMP"); |
| 39 | if (!tmp_path.size()) tmp_path = "/tmp"; |
| 40 | return tmp_path; |
| 41 | } |
no test coverage detected