1
0
mirror of synced 2025-02-19 03:34:23 +01:00

updater: Fixed updater not working properly on macOS

This commit is contained in:
WerWolv 2025-02-15 17:50:29 +01:00
parent a42e4c5299
commit 8b2184f8e3
5 changed files with 17 additions and 21 deletions

@ -1 +1 @@
Subproject commit 2ea4b7d73b9d8828c70d88ac729b00c603f8f7e7
Subproject commit 4b42068eca113e45e1a052e0437a5c7a96c3eda5

View File

@ -44,7 +44,7 @@ namespace hex::paths {
if (includeSystemFolders) {
if (auto executablePath = wolv::io::fs::getExecutablePath(); executablePath.has_value()) {
paths.push_back(*executablePath);
paths.push_back(executablePath->parent_path());
}
}

View File

@ -341,7 +341,7 @@ namespace hex {
#if defined(OS_WINDOWS)
std::ignore = system(hex::format("start \"\" {0}", command).c_str());
#elif defined(OS_MACOS)
std::ignore = system(hex::format("open {0}", command).c_str());
std::ignore = system(hex::format("{0}", command).c_str());
#elif defined(OS_LINUX)
executeCmd({"xdg-open", command});
#elif defined(OS_WEB)

View File

@ -7,14 +7,10 @@ add_executable(updater
target_compile_definitions(updater PRIVATE IMHEX_PROJECT_NAME="${PROJECT_NAME}")
target_link_libraries(updater PRIVATE libimhex ${FMT_LIBRARIES})
add_dependencies(main updater)
setupCompilerFlags(updater)
if (APPLE)
set(OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUNDLE_NAME}/Contents/MacOS")
else ()
set(OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
endif()
set_target_properties(updater PROPERTIES
OUTPUT_NAME "imhex-updater"
RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}
RUNTIME_OUTPUT_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY}
)

View File

@ -80,9 +80,9 @@ std::string getUpdateType() {
return "win-msi";
#elif defined (OS_MACOS)
#if defined(__x86_64__)
return "mac-dmg-x86";
#elif defined(__arm__)
return "mac-dmg-arm";
return "macos-dmg-x86";
#elif defined(__arm64__)
return "macos-dmg-arm";
#endif
#elif defined (OS_LINUX)
if (hex::executeCommand("grep 'ID=ubuntu' /etc/os-release") == 0) {
@ -113,15 +113,15 @@ int installUpdate(const std::string &type, std::fs::path updatePath) {
};
constexpr static auto UpdateHandlers = {
UpdateHandler { "win-msi", ".msi", "msiexec /i {} /qb" },
UpdateHandler { "macos-dmg-x86", ".dmg", "hdiutil attach {}" },
UpdateHandler { "macos-dmg-arm", ".dmg", "hdiutil attach {}" },
UpdateHandler { "linux-deb-24.04", ".deb", "sudo apt update && sudo apt install -y --fix-broken {}" },
UpdateHandler { "linux-deb-24.10", ".deb", "sudo apt update && sudo apt install -y --fix-broken {}" },
UpdateHandler { "linux-rpm-40", ".rpm", "sudo rpm -i {}" },
UpdateHandler { "linux-rpm-41", ".rpm", "sudo rpm -i {}" },
UpdateHandler { "linux-rpm-rawhide", ".rpm", "sudo rpm -i {}" },
UpdateHandler { "linux-arch", ".zst", "sudo pacman -Syy && sudo pacman -U --noconfirm {}" }
UpdateHandler { "win-msi", ".msi", "msiexec /i \"{}\" /qb" },
UpdateHandler { "macos-dmg-x86", ".dmg", "hdiutil attach -autoopen \"{}\"" },
UpdateHandler { "macos-dmg-arm", ".dmg", "hdiutil attach -autoopen \"{}\"" },
UpdateHandler { "linux-deb-24.04", ".deb", "sudo apt update && sudo apt install -y --fix-broken \"{}\"" },
UpdateHandler { "linux-deb-24.10", ".deb", "sudo apt update && sudo apt install -y --fix-broken \"{}\"" },
UpdateHandler { "linux-rpm-40", ".rpm", "sudo rpm -i \"{}\"" },
UpdateHandler { "linux-rpm-41", ".rpm", "sudo rpm -i \"{}\"" },
UpdateHandler { "linux-rpm-rawhide", ".rpm", "sudo rpm -i \"{}\"" },
UpdateHandler { "linux-arch", ".zst", "sudo pacman -Syy && sudo pacman -U --noconfirm \"{}\"" }
};
for (const auto &handler : UpdateHandlers) {