Automatically refresh filebrowser on window focus, and preserve path after scanning

This commit is contained in:
Antoine Pilote
2024-09-05 19:44:27 -04:00
parent 9e05e6883a
commit 422331dec2
11 changed files with 110 additions and 2 deletions

View File

@@ -694,8 +694,28 @@ namespace Nuake
void FileSystemUI::RefreshFileBrowser()
{
Scan();
}
void FileSystemUI::Scan()
{
if (!m_CurrentDirectory)
{
return;
}
std::string previousPath = m_CurrentDirectory->FullPath;
FileSystem::Scan();
m_CurrentDirectory = FileSystem::RootDirectory;
if (FileSystem::DirectoryExists(previousPath, true))
{
m_CurrentDirectory = FileSystem::GetDirectory(FileSystem::AbsoluteToRelative(previousPath));
}
else
{
m_CurrentDirectory = FileSystem::RootDirectory;
}
}
float h = 200;