MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / GetTempFilePath

Function GetTempFilePath

layers/utils/file_system_utils.cpp:25–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23#include "vk_layer_config.h"
24
25std::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}

Callers 1

FinishDeviceSetupMethod · 0.85

Calls 4

GetEnvironmentFunction · 0.85
statClass · 0.85
c_strMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected