Skip to content

Commit

Permalink
Fixed critical file dialog bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
5cript committed Nov 22, 2023
1 parent e2f477e commit 60c9499
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions nui/src/nui/backend/filesystem/file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

namespace Nui::FileDialog
{
//#####################################################################################################################
// #####################################################################################################################
namespace
{
//---------------------------------------------------------------------------------------------------------------------
std::vector<std::string> flattenFilters(std::vector<Filter> const& filters)
{
std::vector<std::string> flattenedFilters;
if (flattenedFilters.empty())
if (filters.empty())
{
flattenedFilters.push_back("All files");
flattenedFilters.push_back("*");
Expand Down Expand Up @@ -76,6 +76,7 @@ namespace Nui::FileDialog
if (result.empty())
return std::nullopt;
std::vector<std::filesystem::path> paths;
paths.resize(result.size());
std::transform(result.begin(), result.end(), paths.begin(), [](std::string const& path) {
return std::filesystem::path(path);
});
Expand Down Expand Up @@ -115,5 +116,5 @@ namespace Nui::FileDialog
return std::nullopt;
return std::filesystem::path(result);
}
//#####################################################################################################################
// #####################################################################################################################
}
4 changes: 2 additions & 2 deletions nui/src/nui/frontend/filesystem/file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ namespace Nui::FileDialog
opts.set("filters", Nui::val::array());
for (auto const& filter : options.filters)
{
Nui::val filterVal;
Nui::val filterVal = Nui::val::object();
filterVal.set("name", convertToVal(filter.name));
filterVal.set("masks", convertToVal(filter.masks));
opts["filter"].call<void>("push", filterVal);
opts["filters"].call<void>("push", filterVal);
}
opts.set("forcePath", convertToVal(options.forcePath));
}
Expand Down

0 comments on commit 60c9499

Please sign in to comment.