mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -05:00
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:
@@ -27,7 +27,7 @@ namespace hex::plugin::builtin::prv {
|
||||
void writeRaw(u64 offset, const void *buffer, size_t size) override;
|
||||
[[nodiscard]] size_t getActualSize() const override;
|
||||
|
||||
void setPath(const fs::path &path);
|
||||
void setPath(const std::fs::path &path);
|
||||
|
||||
[[nodiscard]] bool open() override;
|
||||
void close() override;
|
||||
@@ -42,7 +42,7 @@ namespace hex::plugin::builtin::prv {
|
||||
void reloadDrives();
|
||||
|
||||
std::set<std::string> m_availableDrives;
|
||||
fs::path m_path;
|
||||
std::fs::path m_path;
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
HANDLE m_diskHandle = INVALID_HANDLE_VALUE;
|
||||
|
||||
@@ -38,12 +38,12 @@ namespace hex::plugin::builtin::prv {
|
||||
[[nodiscard]] size_t getActualSize() const override;
|
||||
|
||||
void save() override;
|
||||
void saveAs(const fs::path &path) override;
|
||||
void saveAs(const std::fs::path &path) override;
|
||||
|
||||
[[nodiscard]] std::string getName() const override;
|
||||
[[nodiscard]] std::vector<std::pair<std::string, std::string>> getDataInformation() const override;
|
||||
|
||||
void setPath(const fs::path &path);
|
||||
void setPath(const std::fs::path &path);
|
||||
|
||||
[[nodiscard]] bool open() override;
|
||||
void close() override;
|
||||
@@ -56,7 +56,7 @@ namespace hex::plugin::builtin::prv {
|
||||
int m_file = -1;
|
||||
#endif
|
||||
|
||||
fs::path m_path;
|
||||
std::fs::path m_path;
|
||||
void *m_mappedFile = nullptr;
|
||||
size_t m_fileSize = 0;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace hex::plugin::builtin::prv {
|
||||
[[nodiscard]] size_t getActualSize() const override;
|
||||
|
||||
void save() override;
|
||||
void saveAs(const fs::path &path) override;
|
||||
void saveAs(const std::fs::path &path) override;
|
||||
|
||||
[[nodiscard]] std::string getName() const override;
|
||||
[[nodiscard]] std::vector<std::pair<std::string, std::string>> getDataInformation() const override;
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace hex::plugin::builtin {
|
||||
void drawGotoPopup();
|
||||
void drawEditPopup();
|
||||
|
||||
void openFile(const fs::path &path);
|
||||
void openFile(const std::fs::path &path);
|
||||
|
||||
void copyBytes() const;
|
||||
void pasteBytes() const;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace hex::plugin::builtin {
|
||||
private:
|
||||
pl::PatternLanguage *m_parserRuntime;
|
||||
|
||||
std::vector<fs::path> m_possiblePatternFiles;
|
||||
std::vector<std::fs::path> m_possiblePatternFiles;
|
||||
u32 m_selectedPatternFile = 0;
|
||||
bool m_runAutomatically = false;
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace hex::plugin::builtin {
|
||||
void drawEnvVars(ImVec2 size);
|
||||
void drawVariableSettings(ImVec2 size);
|
||||
|
||||
void loadPatternFile(const fs::path &path);
|
||||
void loadPatternFile(const std::fs::path &path);
|
||||
void clearPatterns();
|
||||
|
||||
void parsePattern(const std::string &code);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <hex/ui/view.hpp>
|
||||
#include <hex/helpers/net.hpp>
|
||||
#include <hex/helpers/paths.hpp>
|
||||
#include <hex/helpers/fs.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <future>
|
||||
@@ -44,7 +44,7 @@ namespace hex::plugin::builtin {
|
||||
Net m_net;
|
||||
std::future<Response<std::string>> m_apiRequest;
|
||||
std::future<Response<void>> m_download;
|
||||
fs::path m_downloadPath;
|
||||
std::fs::path m_downloadPath;
|
||||
|
||||
std::vector<StoreEntry> m_patterns, m_includes, m_magics, m_constants, m_yara, m_encodings;
|
||||
|
||||
@@ -53,8 +53,8 @@ namespace hex::plugin::builtin {
|
||||
void refresh();
|
||||
void parseResponse();
|
||||
|
||||
bool download(ImHexPath pathType, const std::string &fileName, const std::string &url, bool update);
|
||||
bool remove(ImHexPath pathType, const std::string &fileName);
|
||||
bool download(fs::ImHexPath pathType, const std::string &fileName, const std::string &url, bool update);
|
||||
bool remove(fs::ImHexPath pathType, const std::string &fileName);
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user