| 269 | } |
| 270 | |
| 271 | std::string cmInstrumentation::GetFileByTimestamp( |
| 272 | cmInstrumentation::LatestOrOldest order, std::string const& dataSubdir, |
| 273 | std::string const& exclude) |
| 274 | { |
| 275 | std::string fullDir = cmStrCat(this->dataDir, '/', dataSubdir); |
| 276 | std::string result; |
| 277 | if (cmSystemTools::FileExists(fullDir)) { |
| 278 | cmsys::Directory d; |
| 279 | if (d.Load(fullDir)) { |
| 280 | for (unsigned int i = 0; i < d.GetNumberOfFiles(); i++) { |
| 281 | std::string fname = d.GetFileName(i); |
| 282 | if (fname != "." && fname != ".." && fname != exclude && |
| 283 | (result.empty() || |
| 284 | (order == LatestOrOldest::Latest && fname > result) || |
| 285 | (order == LatestOrOldest::Oldest && fname < result))) { |
| 286 | result = fname; |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | } |
| 291 | return result; |
| 292 | } |
| 293 | |
| 294 | void cmInstrumentation::RemoveOldFiles(std::string const& dataSubdir) |
| 295 | { |