mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
impr: Make accept pattern popup open faster and close correctly
This commit is contained in:
@@ -1407,6 +1407,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
m_possiblePatternFiles.get(provider).clear();
|
||||
|
||||
bool popupOpen = false;
|
||||
std::error_code errorCode;
|
||||
for (const auto &dir : fs::getDefaultPaths(fs::ImHexPath::Patterns)) {
|
||||
for (auto &entry : std::fs::recursive_directory_iterator(dir, errorCode)) {
|
||||
@@ -1423,16 +1424,22 @@ namespace hex::plugin::builtin {
|
||||
log::warn("Failed to preprocess file {} during MIME analysis", entry.path().string());
|
||||
}
|
||||
|
||||
if (foundCorrectType)
|
||||
m_possiblePatternFiles.get(provider).push_back(entry.path());
|
||||
if (foundCorrectType) {
|
||||
{
|
||||
std::scoped_lock lock(m_possiblePatternFilesMutex);
|
||||
|
||||
m_possiblePatternFiles.get(provider).push_back(entry.path());
|
||||
}
|
||||
|
||||
if (!popupOpen) {
|
||||
PopupAcceptPattern::open(this);
|
||||
popupOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
runtime.reset();
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_possiblePatternFiles.get(provider).empty()) {
|
||||
PopupAcceptPattern::open(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user