mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 21:05:56 -05:00
impr: Display folder names of files in subfolders in file chooser popup
This commit is contained in:
@@ -1067,8 +1067,9 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.custom_encoding" }, 5050,
|
||||
Shortcut::None,
|
||||
[this]{
|
||||
const auto basePaths = fs::getDefaultPaths(fs::ImHexPath::Encodings);
|
||||
std::vector<std::fs::path> paths;
|
||||
for (const auto &path : fs::getDefaultPaths(fs::ImHexPath::Encodings)) {
|
||||
for (const auto &path : basePaths) {
|
||||
std::error_code error;
|
||||
for (const auto &entry : std::fs::recursive_directory_iterator(path, error)) {
|
||||
if (!entry.is_regular_file()) continue;
|
||||
@@ -1077,7 +1078,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
PopupFileChooser::open(paths, std::vector<hex::fs::ItemFilter>{ {"Thingy Table File", "tbl"} }, false,
|
||||
PopupFileChooser::open(basePaths, paths, std::vector<hex::fs::ItemFilter>{ {"Thingy Table File", "tbl"} }, false,
|
||||
[this](const auto &path) {
|
||||
TaskManager::createTask("Loading encoding file", 0, [this, path](auto&) {
|
||||
auto encoding = EncodingFile(EncodingFile::Type::Thingy, path);
|
||||
|
||||
@@ -1159,9 +1159,10 @@ namespace hex::plugin::builtin {
|
||||
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.file", "hex.builtin.menu.file.import", "hex.builtin.menu.file.import.pattern" }, 4050, Shortcut::None,
|
||||
[this] {
|
||||
auto provider = ImHexApi::Provider::get();
|
||||
const auto basePaths = fs::getDefaultPaths(fs::ImHexPath::Patterns);
|
||||
std::vector<std::fs::path> paths;
|
||||
|
||||
for (const auto &imhexPath : fs::getDefaultPaths(fs::ImHexPath::Patterns)) {
|
||||
for (const auto &imhexPath : basePaths) {
|
||||
if (!wolv::io::fs::exists(imhexPath)) continue;
|
||||
|
||||
std::error_code error;
|
||||
@@ -1172,7 +1173,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
PopupFileChooser::open(paths, std::vector<hex::fs::ItemFilter>{ { "Pattern File", "hexpat" } }, false,
|
||||
PopupFileChooser::open(basePaths, paths, std::vector<hex::fs::ItemFilter>{ { "Pattern File", "hexpat" } }, false,
|
||||
[this, provider](const std::fs::path &path) {
|
||||
this->loadPatternFile(path, provider);
|
||||
AchievementManager::unlockAchievement("hex.builtin.achievement.patterns", "hex.builtin.achievement.patterns.load_existing.name");
|
||||
|
||||
@@ -114,8 +114,9 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
if (ImGui::IconButton(ICON_VS_ADD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
||||
const auto basePaths = fs::getDefaultPaths(fs::ImHexPath::Yara);
|
||||
std::vector<std::fs::path> paths;
|
||||
for (const auto &path : fs::getDefaultPaths(fs::ImHexPath::Yara)) {
|
||||
for (const auto &path : basePaths) {
|
||||
std::error_code error;
|
||||
for (const auto &entry : std::fs::recursive_directory_iterator(path, error)) {
|
||||
if (!entry.is_regular_file()) continue;
|
||||
@@ -125,7 +126,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
}
|
||||
|
||||
PopupFileChooser::open(paths, std::vector<hex::fs::ItemFilter>{ { "Yara File", "yara" }, { "Yara File", "yar" } }, true,
|
||||
PopupFileChooser::open(basePaths, paths, std::vector<hex::fs::ItemFilter>{ { "Yara File", "yara" }, { "Yara File", "yar" } }, true,
|
||||
[&](const auto &path) {
|
||||
this->m_rules->push_back({ path.filename(), path });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user