sys: Refactor of filesystem functions. Fixed crashes where fs errors weren't caught correctly

Addresses the crash mentioned in #462
This commit is contained in:
WerWolv
2022-03-04 11:36:37 +01:00
parent 7866e3fc2a
commit 2739320f10
60 changed files with 442 additions and 398 deletions

View File

@@ -1,6 +1,6 @@
#include "content/views/view_constants.hpp"
#include <hex/helpers/paths.hpp>
#include <hex/helpers/fs.hpp>
#include <hex/helpers/logger.hpp>
#include <hex/helpers/utils.hpp>
@@ -24,10 +24,11 @@ namespace hex::plugin::builtin {
this->m_constants.clear();
this->m_filterIndices.clear();
for (const auto &path : hex::getPath(ImHexPath::Constants)) {
for (const auto &path : fs::getDefaultPaths(fs::ImHexPath::Constants)) {
if (!fs::exists(path)) continue;
for (auto &file : fs::directory_iterator(path)) {
std::error_code error;
for (auto &file : std::fs::directory_iterator(path, error)) {
if (!file.is_regular_file()) continue;
try {