| 350 | } |
| 351 | |
| 352 | bool Env::LocalTempFilename(string* filename) { |
| 353 | std::vector<string> dirs; |
| 354 | GetLocalTempDirectories(&dirs); |
| 355 | |
| 356 | // Try each directory, as they might be full, have inappropriate |
| 357 | // permissions or have different problems at times. |
| 358 | for (const string& dir : dirs) { |
| 359 | *filename = io::JoinPath(dir, "tempfile-"); |
| 360 | if (CreateUniqueFileName(filename, "")) { |
| 361 | return true; |
| 362 | } |
| 363 | } |
| 364 | return false; |
| 365 | } |
| 366 | |
| 367 | bool Env::CreateUniqueFileName(string* prefix, const string& suffix) { |
| 368 | int32 tid = GetCurrentThreadId(); |