sys: Log to a file when ImHex wasn't opened though a terminal

This commit is contained in:
WerWolv
2022-01-17 20:06:00 +01:00
parent 2df4e22bf8
commit 8701e0f402
15 changed files with 155 additions and 42 deletions

View File

@@ -49,7 +49,8 @@ namespace hex::init {
try {
status = task() && status;
} catch (...) {
} catch (std::exception &e) {
log::error("Init task {} threw an exception: {}", name, e.what());
status = false;
}

View File

@@ -57,7 +57,7 @@ namespace hex::init {
bool createDirectories() {
bool result = true;
std::array paths = {
constexpr std::array paths = {
ImHexPath::Patterns,
ImHexPath::PatternsInclude,
ImHexPath::Magic,
@@ -66,7 +66,8 @@ namespace hex::init {
ImHexPath::Config,
ImHexPath::Constants,
ImHexPath::Yara,
ImHexPath::Python
ImHexPath::Python,
ImHexPath::Logs
};
for (auto path : paths) {
@@ -225,7 +226,8 @@ namespace hex::init {
}
for (const auto &plugin : PluginManager::getPlugins()) {
plugin.initializePlugin();
if (!plugin.initializePlugin())
log::error("Failed to initialize plugin {}", plugin.getPath().filename().string());
}
return true;