Fix renaming of files in the project tree
We must add the new node for the new file in the new directory, not in the original root directory. The file watcher will also delete the old node, so there is no point in renaming the file. Fixes: lp:1852357 * https://bugs.launchpad.net/kicad/+bug/1852357
This commit is contained in:
parent
64e094f211
commit
2fc5e6c79f
|
@ -897,6 +897,7 @@ void TREE_PROJECT_FRAME::OnFileSystemEvent( wxFileSystemWatcherEvent& event )
|
|||
case wxFSW_EVENT_RENAME :
|
||||
{
|
||||
const wxFileName& newpath = event.GetNewPath();
|
||||
wxString newdir = newpath.GetPath();
|
||||
wxString newfn = newpath.GetFullPath();
|
||||
|
||||
while( kid.IsOk() )
|
||||
|
@ -912,7 +913,8 @@ void TREE_PROJECT_FRAME::OnFileSystemEvent( wxFileSystemWatcherEvent& event )
|
|||
kid = m_TreeProject->GetNextChild( root_id, cookie );
|
||||
}
|
||||
|
||||
AddItemToTreeProject( newfn, root_id, false );
|
||||
wxTreeItemId newroot_id = findSubdirTreeItem( newdir );
|
||||
AddItemToTreeProject( newfn, newroot_id, false );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -120,8 +120,6 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check )
|
|||
return false;
|
||||
}
|
||||
|
||||
SetFileName( newFile );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue