mirror of https://github.com/godotengine/godot
Propagate errors through `EditorFileSystem::copy_file`
This commit is contained in:
parent
757bba192e
commit
08427e198d
|
|
@ -1550,12 +1550,12 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin
|
|||
|
||||
Error err = EditorFileSystem::get_singleton()->copy_file(old_path, new_path);
|
||||
if (err != OK) {
|
||||
EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + ": " + error_names[err] + "\n");
|
||||
EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + U" → " + new_path + ": " + error_names[err] + "\n");
|
||||
}
|
||||
} else {
|
||||
Error err = EditorFileSystem::get_singleton()->copy_directory(old_path, new_path);
|
||||
if (err != OK) {
|
||||
EditorNode::get_singleton()->add_io_error(TTR("Error duplicating directory:") + "\n" + old_path + "\n");
|
||||
EditorNode::get_singleton()->add_io_error(TTR("Error duplicating directory:") + "\n" + old_path + U" → " + new_path + ": " + error_names[err] + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3555,7 +3555,10 @@ Error EditorFileSystem::make_dir_recursive(const String &p_path, const String &p
|
|||
}
|
||||
|
||||
Error EditorFileSystem::copy_file(const String &p_from, const String &p_to) {
|
||||
_copy_file(p_from, p_to);
|
||||
Error err = _copy_file(p_from, p_to);
|
||||
if (err != OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
EditorFileSystemDirectory *parent = get_filesystem_path(p_to.get_base_dir());
|
||||
ERR_FAIL_NULL_V(parent, ERR_FILE_NOT_FOUND);
|
||||
|
|
|
|||
Loading…
Reference in New Issue