From 73ef13932da21a4432ff9280632582747ee8f765 Mon Sep 17 00:00:00 2001 From: emerycp Date: Sun, 9 Jul 2023 10:43:45 -0400 Subject: [PATCH] =?UTF-8?q?Refresh=20File=20Browser=20on=20F=C3=ACle=20Cre?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/src/Windows/FileSystemUI.cpp | 14 +++++++++++--- Editor/src/Windows/FileSystemUI.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 13acd965..a5a093a1 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -211,6 +211,8 @@ namespace Nuake { FileSystem::BeginWriteFile(path); FileSystem::WriteLine(jsonData.dump(4)); FileSystem::EndWriteFile(); + + RefreshFileBrowser(); } } @@ -224,10 +226,11 @@ namespace Nuake { if (!path.empty()) { - FileSystem::BeginWriteFile(path); FileSystem::WriteLine(TEMPLATE_SCRIPT); FileSystem::EndWriteFile(); + + RefreshFileBrowser(); } } @@ -239,6 +242,12 @@ namespace Nuake { } + void FileSystemUI::RefreshFileBrowser() + { + FileSystem::Scan(); + m_CurrentDirectory = FileSystem::RootDirectory; + } + float h = 200; static float sz1 = 300; static float sz2 = 300; @@ -301,8 +310,7 @@ namespace Nuake { { if (ImGui::Button("Refresh")) { - FileSystem::Scan(); - m_CurrentDirectory = FileSystem::RootDirectory; + RefreshFileBrowser(); } ImGui::SameLine(); diff --git a/Editor/src/Windows/FileSystemUI.h b/Editor/src/Windows/FileSystemUI.h index aa630bed..be528a2b 100644 --- a/Editor/src/Windows/FileSystemUI.h +++ b/Editor/src/Windows/FileSystemUI.h @@ -26,5 +26,6 @@ namespace Nuake { void DrawFile(Ref file); void DrawDirectoryExplorer(); void DrawContextMenu(); + void RefreshFileBrowser(); }; }