MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetLocalTempDirectories

Method GetLocalTempDirectories

tensorflow/core/platform/posix/env.cc:230–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228#endif
229
230void PosixEnv::GetLocalTempDirectories(std::vector<string>* list) {
231 list->clear();
232 // Directories, in order of preference. If we find a dir that
233 // exists, we stop adding other less-preferred dirs
234 const char* candidates[] = {
235 // Non-null only during unittest/regtest
236 getenv("TEST_TMPDIR"),
237
238 // Explicitly-supplied temp dirs
239 getenv("TMPDIR"),
240 getenv("TMP"),
241
242#if defined(__ANDROID__)
243 "/data/local/tmp",
244#endif
245
246 // If all else fails
247 "/tmp",
248 };
249
250 for (const char* d : candidates) {
251 if (!d || d[0] == '\0') continue; // Empty env var
252
253 // Make sure we don't surprise anyone who's expecting a '/'
254 string dstr = d;
255 if (dstr[dstr.size() - 1] != '/') {
256 dstr += "/";
257 }
258
259 struct stat statbuf;
260 if (!stat(d, &statbuf) && S_ISDIR(statbuf.st_mode) &&
261 !access(dstr.c_str(), 0)) {
262 // We found a dir that exists and is accessible - we're done.
263 list->push_back(dstr);
264 return;
265 }
266 }
267}
268
269} // namespace tensorflow

Callers 3

RenderAndDisplayGraphFunction · 0.45
EmitModuleToHsacoFunction · 0.45

Calls 5

c_strMethod · 0.80
statClass · 0.70
clearMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected