Skip to content

Commit

Permalink
Fixed exception in fs.list when non-ASCII names are present
Browse files Browse the repository at this point in the history
  • Loading branch information
MCJack123 committed Jul 13, 2024
1 parent 8e0c55b commit 5e6ff4c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/apis/fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static int fs_list(lua_State *L) {
gotdir = true;
for (const auto& dir : fs::directory_iterator(path, e)) {
if (dir.path().filename() == ".DS_Store" || dir.path().filename() == "desktop.ini") continue;
entries.insert(dir.path().filename().string());
entries.insert(dir.path().filename().u8string());
}
}
}
Expand Down Expand Up @@ -644,7 +644,7 @@ static std::list<std::string> matchWildcard(Computer * comp, const std::list<std
if (fs::is_directory(path, e)) {
for (const auto& dir : fs::directory_iterator(path, e)) {
if (dir.path().filename() == ".DS_Store" || dir.path().filename() == "desktop.ini") continue;
if (std::regex_match(dir.path().filename().string(), std::regex(pathc_regex))) nextOptions.push_back(opt + (opt.empty() ? "" : "/") + dir.path().filename().string());
if (std::regex_match(dir.path().filename().u8string(), std::regex(pathc_regex))) nextOptions.push_back(opt + (opt.empty() ? "" : "/") + dir.path().filename().u8string());
}
}
}
Expand Down

0 comments on commit 5e6ff4c

Please sign in to comment.