From af38f76f013538db04a928177e19373f73730ba6 Mon Sep 17 00:00:00 2001 From: Jeff Young <jeff@rokeby.ie> Date: Thu, 16 Jan 2025 16:18:15 +0000 Subject: [PATCH] Don't double-create new folders in project tree. --- kicad/dialogs/panel_jobset.cpp | 2 -- kicad/project_tree_pane.cpp | 10 ++++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/kicad/dialogs/panel_jobset.cpp b/kicad/dialogs/panel_jobset.cpp index aac53f2227..958dc7f038 100644 --- a/kicad/dialogs/panel_jobset.cpp +++ b/kicad/dialogs/panel_jobset.cpp @@ -222,7 +222,6 @@ public: // Bring the Kicad manager frame back to the front m_frame->Raise(); - m_frame->RefreshProjectTree(); } ); } @@ -919,7 +918,6 @@ void PANEL_JOBSET::OnGenerateAllOutputsClick( wxCommandEvent& event ) // Bring the Kicad manager frame back to the front m_frame->Raise(); - m_frame->RefreshProjectTree(); } ); } diff --git a/kicad/project_tree_pane.cpp b/kicad/project_tree_pane.cpp index 054e1fd390..3fdb96c33d 100644 --- a/kicad/project_tree_pane.cpp +++ b/kicad/project_tree_pane.cpp @@ -1286,6 +1286,13 @@ void PROJECT_TREE_PANE::onFileSystemEvent( wxFileSystemWatcherEvent& event ) wxString subdir = pathModified.GetPath(); wxString fn = pathModified.GetFullPath(); + // Adjust directories to look like a file item (path and name). + if( pathModified.GetFullName().IsEmpty() ) + { + subdir = subdir.BeforeLast( '/' ); + fn = fn.BeforeLast( '/' ); + } + switch( event.GetChangeType() ) { case wxFSW_EVENT_DELETE: @@ -1314,8 +1321,7 @@ void PROJECT_TREE_PANE::onFileSystemEvent( wxFileSystemWatcherEvent& event ) { case wxFSW_EVENT_CREATE: { - wxTreeItemId newitem = - addItemToProjectTree( pathModified.GetFullPath(), root_id, nullptr, true ); + wxTreeItemId newitem = addItemToProjectTree( fn, root_id, nullptr, true ); // If we are in the process of renaming a file, select the new one // This is needed for MSW and OSX, since we don't get RENAME events from them, just a