File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -477,9 +477,16 @@ bool SymlinkingPrebuiltDictionaries::Run(Deployer* deployer) {
477
477
fs::path entry (test->path ());
478
478
if (fs::is_symlink (entry)) {
479
479
try {
480
- auto target_path = fs::canonical (entry);
481
- if (target_path.has_parent_path () &&
482
- fs::equivalent (shared_data_path, target_path.parent_path ())) {
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) {
483
490
LOG (INFO) << " removing symlink: " << entry.filename ().string ();
484
491
fs::remove (entry);
485
492
}
You can’t perform that action at this time.
0 commit comments