diff --git a/kicad/tree_project_frame.cpp b/kicad/tree_project_frame.cpp index 6ec5af712a..4f4a170751 100644 --- a/kicad/tree_project_frame.cpp +++ b/kicad/tree_project_frame.cpp @@ -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; } diff --git a/kicad/treeproject_item.cpp b/kicad/treeproject_item.cpp index c994912ac7..e54ee09472 100644 --- a/kicad/treeproject_item.cpp +++ b/kicad/treeproject_item.cpp @@ -120,8 +120,6 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check ) return false; } - SetFileName( newFile ); - return true; }