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(); }; }