Skip to content

Commit 19dbfec

Browse files
committed
Fix symlink copy in DirAccess::copy_dir.
1 parent 45509c2 commit 19dbfec

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

core/io/dir_access.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,19 +490,22 @@ Error DirAccess::_copy_dir(Ref<DirAccess> &p_target_da, const String &p_to, int
490490
while (!n.is_empty()) {
491491
if (n != "." && n != "..") {
492492
if (p_copy_links && is_link(get_current_dir().path_join(n))) {
493-
create_link(read_link(get_current_dir().path_join(n)), p_to + n);
493+
Error err = p_target_da->create_link(read_link(get_current_dir().path_join(n)), p_to + n);
494+
if (err) {
495+
ERR_PRINT(vformat("Failed to copy symlink \"%s\".", n));
496+
}
494497
} else if (current_is_dir()) {
495498
dirs.push_back(n);
496499
} else {
497500
const String &rel_path = n;
498501
if (!n.is_relative_path()) {
499502
list_dir_end();
500-
return ERR_BUG;
503+
ERR_FAIL_V_MSG(ERR_BUG, vformat("BUG: \"%s\" is not a relative path.", n));
501504
}
502505
Error err = copy(get_current_dir().path_join(n), p_to + rel_path, p_chmod_flags);
503506
if (err) {
504507
list_dir_end();
505-
return err;
508+
ERR_FAIL_V_MSG(err, vformat("Failed to copy file \"%s\".", n));
506509
}
507510
}
508511
}

0 commit comments

Comments
 (0)