From e6e40cdabab80cc96c47cb9a023276b4149382d7 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 30 May 2019 16:09:01 -0400 Subject: [PATCH] Update Sidebar open logic to use the correct folder --- CMakeLists.txt | 2 ++ cmake.sh | 8 +------- src/widgets/FilePane.cpp | 4 ++-- src/widgets/MainFrame.cpp | 6 +++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ebc22e..9240524 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,8 @@ include_directories(${INCLUDE_DIRS}) # set some platform-specific flags if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(MACOSX_DEPLOYMENT_TARGET 10.9) + #set(CMAKE_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk") set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS} -stdlib=libc++") add_definitions(-D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_ -D__WXMAC__) else() diff --git a/cmake.sh b/cmake.sh index 747a71e..25c2422 100755 --- a/cmake.sh +++ b/cmake.sh @@ -1,13 +1,7 @@ #!/bin/bash mkdir -p build -unset MACOSX_DEPLOYMENT_TARGET -unset CMAKE_OSX_SYSROOT - -export MACOSX_DEPLOYMENT_TARGET="10.9" -export CMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" - cd build -cmake -stdlib=libc++ .. +cmake .. make "$@" cd .. diff --git a/src/widgets/FilePane.cpp b/src/widgets/FilePane.cpp index 882490c..32bba94 100644 --- a/src/widgets/FilePane.cpp +++ b/src/widgets/FilePane.cpp @@ -75,7 +75,7 @@ void FilePane::CreateTree(const wxString &path) wxTreeListItem root = this->GetRootItem(); auto *files = new wxArrayString(); - wxFileName rootPath(path); + wxFileName rootPath = wxFileName::DirName(path); rootPath.MakeAbsolute(); this->base_path = rootPath.GetPath(); @@ -196,7 +196,7 @@ void FilePane::AddDirToTree(wxTreeListItem &root, const wxString &path, const wx wxLogInfo("-- Recursing to deeper folder: %s(%s), parent: %s(%s)", dirs[0], dir, newParent, parentDir); - this->AddDirToTree(dir_node, dirs[0], newParent); + this->AddDirToTree(dir_node, dirs[0], newParent, true); } delete files; diff --git a/src/widgets/MainFrame.cpp b/src/widgets/MainFrame.cpp index a08825f..0a4dd7b 100644 --- a/src/widgets/MainFrame.cpp +++ b/src/widgets/MainFrame.cpp @@ -292,13 +292,13 @@ void MainFrame::OnOpen(wxCommandEvent &WXUNUSED(event)) void MainFrame::OnOpenFolder(wxCommandEvent &event) { - wxString path; - wxDirDialog dlg(this, "Select Project Dir", wxEmptyString, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST | wxDD_CHANGE_DIR); if (dlg.ShowModal() != wxID_OK) return; - filePane->CreateTree(dlg.GetPath()); + auto path = dlg.GetPath(); + + filePane->CreateTree(path); } /**