From 08427e198da7126a2d8db694880b3453dddcec80 Mon Sep 17 00:00:00 2001 From: fish Date: Mon, 8 Dec 2025 22:45:43 -0800 Subject: [PATCH] Propagate errors through `EditorFileSystem::copy_file` --- editor/docks/filesystem_dock.cpp | 4 ++-- editor/file_system/editor_file_system.cpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/editor/docks/filesystem_dock.cpp b/editor/docks/filesystem_dock.cpp index f3b9fa88568..c80c34f68bc 100644 --- a/editor/docks/filesystem_dock.cpp +++ b/editor/docks/filesystem_dock.cpp @@ -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"); } } } diff --git a/editor/file_system/editor_file_system.cpp b/editor/file_system/editor_file_system.cpp index 8a5f876fd43..a286f0956fb 100644 --- a/editor/file_system/editor_file_system.cpp +++ b/editor/file_system/editor_file_system.cpp @@ -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);