File tree 1 file changed +15
-8
lines changed
1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -386,16 +386,23 @@ static bool ConfigNeedsUpdate(Config* config) {
386
386
" config_source_file" , " " , " .yaml"
387
387
}));
388
388
for (auto entry : *timestamps.AsMap ()) {
389
- fs::path source_file_path = resolver->ResolvePath (entry.first );
390
- if (!fs::exists (source_file_path)) {
391
- LOG (INFO) << " source file no longer exists: " << source_file_path.string ();
392
- return true ;
393
- }
394
389
auto value = As<ConfigValue>(entry.second );
395
390
int recorded_time = 0 ;
396
- if (!value || !value->GetInt (&recorded_time) ||
397
- recorded_time != (int ) fs::last_write_time (source_file_path)) {
398
- LOG (INFO) << " source file changed: " << source_file_path.string ();
391
+ if (!value || !value->GetInt (&recorded_time)) {
392
+ LOG (WARNING) << " invalid timestamp for " << entry.first ;
393
+ return true ;
394
+ }
395
+ fs::path source_file = resolver->ResolvePath (entry.first );
396
+ if (!fs::exists (source_file)) {
397
+ if (recorded_time) {
398
+ LOG (INFO) << " source file no longer exists: " << source_file.string ();
399
+ return true ;
400
+ }
401
+ continue ;
402
+ }
403
+ if (recorded_time != (int ) fs::last_write_time (source_file)) {
404
+ LOG (INFO) << " source file " << (recorded_time ? " changed: " : " added: " )
405
+ << source_file.string ();
399
406
return true ;
400
407
}
401
408
}
You can’t perform that action at this time.
0 commit comments