File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -478,21 +478,20 @@ bool SymlinkingPrebuiltDictionaries::Run(Deployer* deployer) {
478
478
if (fs::is_symlink (entry)) {
479
479
try {
480
480
// a symlink becomes dangling if the target file is no longer provided
481
- bool symlink_valid = fs::status_known (fs::symlink_status (entry));
482
- bool linked_to_shared_data = false ;
483
- if (symlink_valid) {
484
- auto target_path = fs::canonical (entry);
485
- linked_to_shared_data =
486
- target_path.has_parent_path () &&
487
- fs::equivalent (shared_data_path, target_path.parent_path ());
488
- }
489
- if (!symlink_valid || linked_to_shared_data) {
481
+ boost::system ::error_code ec;
482
+ auto target_path = fs::canonical (entry, ec);
483
+ bool bad_link = bool (ec);
484
+ bool linked_to_shared_data =
485
+ !bad_link &&
486
+ target_path.has_parent_path () &&
487
+ fs::equivalent (shared_data_path, target_path.parent_path ());
488
+ if (bad_link || linked_to_shared_data) {
490
489
LOG (INFO) << " removing symlink: " << entry.filename ().string ();
491
490
fs::remove (entry);
492
491
}
493
492
}
494
493
catch (const fs::filesystem_error& ex) {
495
- LOG (ERROR) << ex.what ();
494
+ LOG (ERROR) << entry << " : " << ex.what ();
496
495
success = false ;
497
496
}
498
497
}
You can’t perform that action at this time.
0 commit comments