MCPcopy Create free account
hub / github.com/esengine/esengine / handleRename

Function handleRename

packages/editor-app/src/components/FileTree.tsx:463–482  ·  view source on GitHub ↗
(node: TreeNode)

Source from the content-addressed store, hash-verified

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);

Callers 2

ContentBrowserFunction · 0.85
renderNodeFunction · 0.85

Calls 4

refreshTreeFunction · 0.85
renameFileOrFolderMethod · 0.80
joinMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected