(node: TreeNode)
| 461 | }; |
| 462 | |
| 463 | const handleRename = async (node: TreeNode) => { |
| 464 | if (!newName || newName === node.name) { |
| 465 | setRenamingNode(null); |
| 466 | return; |
| 467 | } |
| 468 | |
| 469 | const pathParts = node.path.split(/[/\\]/); |
| 470 | pathParts[pathParts.length - 1] = newName; |
| 471 | const newPath = pathParts.join('/'); |
| 472 | |
| 473 | try { |
| 474 | await TauriAPI.renameFileOrFolder(node.path, newPath); |
| 475 | await refreshTree(); |
| 476 | setRenamingNode(null); |
| 477 | setNewName(''); |
| 478 | } catch (error) { |
| 479 | console.error('Failed to rename:', error); |
| 480 | alert(`${t('fileTree.renameFailed')}: ${error}`); |
| 481 | } |
| 482 | }; |
| 483 | |
| 484 | const handleDeleteClick = (node: TreeNode) => { |
| 485 | setContextMenu(null); |
no test coverage detected