diff --git a/src/rime/lever/deployment_tasks.cc b/src/rime/lever/deployment_tasks.cc index 9b7656228f..cb4b94ffc3 100644 --- a/src/rime/lever/deployment_tasks.cc +++ b/src/rime/lever/deployment_tasks.cc @@ -386,16 +386,23 @@ static bool ConfigNeedsUpdate(Config* config) { "config_source_file", "", ".yaml" })); for (auto entry : *timestamps.AsMap()) { - fs::path source_file_path = resolver->ResolvePath(entry.first); - if (!fs::exists(source_file_path)) { - LOG(INFO) << "source file no longer exists: " << source_file_path.string(); - return true; - } auto value = As(entry.second); int recorded_time = 0; - if (!value || !value->GetInt(&recorded_time) || - recorded_time != (int) fs::last_write_time(source_file_path)) { - LOG(INFO) << "source file changed: " << source_file_path.string(); + if (!value || !value->GetInt(&recorded_time)) { + LOG(WARNING) << "invalid timestamp for " << entry.first; + return true; + } + fs::path source_file = resolver->ResolvePath(entry.first); + if (!fs::exists(source_file)) { + if (recorded_time) { + LOG(INFO) << "source file no longer exists: " << source_file.string(); + return true; + } + continue; + } + if (recorded_time != (int) fs::last_write_time(source_file)) { + LOG(INFO) << "source file " << (recorded_time ? "changed: " : "added: ") + << source_file.string(); return true; } }