/// Prune the cache of files that haven't been accessed in a long time.
bool CachePruning::prune() {
- SmallString<128> TimestampFile(Path);
- sys::path::append(TimestampFile, "llvmcache.timestamp");
+ if (Path.empty())
+ return false;
+
+ bool isPathDir;
+ if (sys::fs::is_directory(Path, isPathDir))
+ return false;
+
+ if (!isPathDir)
+ return false;
if (Expiration == 0 && PercentageOfAvailableSpace == 0) {
DEBUG(dbgs() << "No pruning settings set, exit early\n");
}
// Try to stat() the timestamp file.
+ SmallString<128> TimestampFile(Path);
+ sys::path::append(TimestampFile, "llvmcache.timestamp");
sys::fs::file_status FileStatus;
sys::TimeValue CurrentTime = sys::TimeValue::now();
if (sys::fs::status(TimestampFile, FileStatus)) {