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

@@ -3,7 +3,7 @@
#include <hex.hpp>
#include <hex/helpers/fmt.hpp>
#include <hex/helpers/paths.hpp>
#include <hex/helpers/fs.hpp>
#include <string>
@@ -13,7 +13,7 @@ namespace hex {
class Plugin {
public:
explicit Plugin(const fs::path &path);
explicit Plugin(const std::fs::path &path);
Plugin(const Plugin &) = delete;
Plugin(Plugin &&other) noexcept;
~Plugin();
@@ -26,7 +26,7 @@ namespace hex {
void setImGuiContext(ImGuiContext *ctx) const;
[[nodiscard]] bool isBuiltinPlugin() const;
[[nodiscard]] const fs::path &getPath() const;
[[nodiscard]] const std::fs::path &getPath() const;
[[nodiscard]] bool isLoaded() const;
@@ -40,7 +40,7 @@ namespace hex {
using IsBuiltinPluginFunc = bool (*)();
void *m_handle = nullptr;
fs::path m_path;
std::fs::path m_path;
mutable bool m_initialized = false;
@@ -65,7 +65,7 @@ namespace hex {
public:
PluginManager() = delete;
static bool load(const fs::path &pluginFolder);
static bool load(const std::fs::path &pluginFolder);
static void unload();
static void reload();
@@ -74,7 +74,7 @@ namespace hex {
}
private:
static fs::path s_pluginFolder;
static std::fs::path s_pluginFolder;
static std::vector<Plugin> s_plugins;
};