diff --git a/lib/libimhex/source/api/imhex_api.cpp b/lib/libimhex/source/api/imhex_api.cpp index efbd4abd9..e1b86f91b 100644 --- a/lib/libimhex/source/api/imhex_api.cpp +++ b/lib/libimhex/source/api/imhex_api.cpp @@ -942,41 +942,52 @@ namespace hex { } bool updateImHex(UpdateType updateType) { - // Get the path of the updater executable - std::fs::path executablePath; - - for (const auto &entry : std::fs::directory_iterator(wolv::io::fs::getExecutablePath()->parent_path())) { - if (entry.path().filename().string().starts_with("imhex-updater")) { - executablePath = entry.path(); - break; + #if defined(OS_WEB) + switch (updateType) { + case UpdateType::Stable: + EM_ASM({ window.location.href = window.location.origin; }); + break; + case UpdateType::Nightly: + EM_ASM({ window.location.href = window.location.origin + "/nightly"; }); + break; } - } + #else + // Get the path of the updater executable + std::fs::path executablePath; - if (executablePath.empty() || !wolv::io::fs::exists(executablePath)) - return false; + for (const auto &entry : std::fs::directory_iterator(wolv::io::fs::getExecutablePath()->parent_path())) { + if (entry.path().filename().string().starts_with("imhex-updater")) { + executablePath = entry.path(); + break; + } + } - std::string updateTypeString; - switch (updateType) { - case UpdateType::Stable: - updateTypeString = "stable"; - break; - case UpdateType::Nightly: - updateTypeString = "nightly"; - break; - } + if (executablePath.empty() || !wolv::io::fs::exists(executablePath)) + return false; - EventImHexClosing::subscribe([executablePath, updateTypeString] { - hex::startProgram( - fmt::format("\"{}\" \"{}\"", - wolv::util::toUTF8String(executablePath), - updateTypeString - ) - ); - }); + std::string updateTypeString; + switch (updateType) { + case UpdateType::Stable: + updateTypeString = "stable"; + break; + case UpdateType::Nightly: + updateTypeString = "nightly"; + break; + } - ImHexApi::System::closeImHex(); + EventImHexClosing::subscribe([executablePath, updateTypeString] { + hex::startProgram( + fmt::format("\"{}\" \"{}\"", + wolv::util::toUTF8String(executablePath), + updateTypeString + ) + ); + }); - return true; + ImHexApi::System::closeImHex(); + + return true; + #endif } void addStartupTask(const std::string &name, bool async, const std::function &function) { diff --git a/lib/trace/CMakeLists.txt b/lib/trace/CMakeLists.txt index 4d0f3eebe..2551b671e 100644 --- a/lib/trace/CMakeLists.txt +++ b/lib/trace/CMakeLists.txt @@ -18,7 +18,7 @@ else() source/stacktrace.cpp source/exceptions.cpp ) - target_link_libraries(tracing PRIVATE LLVMDemangle) + target_link_libraries(tracing PRIVATE LLVMDemangle ${FMT_LIBRARIES}) set(LIBIMHEX_LIBRARY_TYPE_PUBLIC PUBLIC) set(LIBIMHEX_LIBRARY_TYPE_PRIVATE PRIVATE) diff --git a/main/updater/source/main.cpp b/main/updater/source/main.cpp index 3cb554a40..c7dcb9299 100644 --- a/main/updater/source/main.cpp +++ b/main/updater/source/main.cpp @@ -118,7 +118,13 @@ std::string_view getUpdateArtifactEnding() { #elif defined (OS_MACOS) return ARCH_DEPENDENT("macOS-x86_64.dmg", "macOS-arm64.dmg"); #elif defined (OS_LINUX) - if (hex::executeCommand("grep 'ID=ubuntu' /etc/os-release") == 0) { + if (hex::getEnvironmentVariable("APPIMAGE").has_value()) { + return ARCH_DEPENDENT("x86_64.AppImage", "arm64.AppImage"); + } else if (hex::getEnvironmentVariable("FLATPAK_BINARY").has_value()) { + return ARCH_DEPENDENT("x86_64.flatpak", "arm64.flatpak"); + } else if (hex::getEnvironmentVariable("SNAP").has_value()) { + return ARCH_DEPENDENT("x86_64.snap", "arm64.snap"); + } else if (hex::executeCommand("grep 'ID=ubuntu' /etc/os-release") == 0) { if (hex::executeCommand("grep 'VERSION_ID=\"24.04\"' /etc/os-release") == 0) return ARCH_DEPENDENT("Ubuntu-24.04-x86_64.deb", ""); else if (hex::executeCommand("grep 'VERSION_ID=\"24.10\"' /etc/os-release") == 0) @@ -142,16 +148,19 @@ std::string_view getUpdateArtifactEnding() { bool installUpdate(const std::fs::path &updatePath) { struct UpdateHandler { - const char *ending; - const char *command; + std::string ending; + std::string command; }; - constexpr static auto UpdateHandlers = { - UpdateHandler { ".msi", "msiexec /i \"{}\" /qb" }, - UpdateHandler { ".dmg", "hdiutil attach -autoopen \"{}\"" }, - UpdateHandler { ".deb", "sudo apt update && sudo apt install -y --fix-broken \"{}\"" }, - UpdateHandler { ".rpm", "sudo rpm -i \"{}\"" }, - UpdateHandler { ".pkg.tar.zst", "sudo pacman -Syy && sudo pacman -U --noconfirm \"{}\"" } + const static auto UpdateHandlers = { + UpdateHandler { ".msi", "msiexec /i \"{}\" /qb" }, + UpdateHandler { ".dmg", "hdiutil attach -autoopen \"{}\"" }, + UpdateHandler { ".deb", "sudo apt install -y --fix-broken \"{}\"" }, + UpdateHandler { ".rpm", "sudo rpm -i \"{}\"" }, + UpdateHandler { ".pkg.tar.zst", "sudo pacman -Syy && sudo pacman -U --noconfirm \"{}\"" }, + UpdateHandler { ".AppImage", fmt::format("sudo cp \"{{}}\" \"{}\"", *hex::getEnvironmentVariable("APPIMAGE")) }, + UpdateHandler { ".flatpak", "sudo flatpak install -y --reinstall \"{}\"" }, + UpdateHandler { ".snap", "sudo snap install --dangerous \"{}\"" }, }; const auto updateFileName = wolv::util::toUTF8String(updatePath.filename()); diff --git a/plugins/builtin/source/content/command_palette_commands.cpp b/plugins/builtin/source/content/command_palette_commands.cpp index 5f0b95001..b5ca1b5e4 100644 --- a/plugins/builtin/source/content/command_palette_commands.cpp +++ b/plugins/builtin/source/content/command_palette_commands.cpp @@ -421,6 +421,11 @@ namespace hex::plugin::builtin { std::vector result; for (const auto &[unlocalizedName, view] : ContentRegistry::Views::impl::getEntries()) { + if (!view->shouldProcess()) + continue; + if (!view->hasViewMenuItemEntry()) + continue; + const auto name = Lang(unlocalizedName); if (!hex::containsIgnoreCase(name, input)) continue;