From 7f6f9334204fc86281707b66414ba9959144c692 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Thu, 12 Sep 2019 14:39:25 -0400 Subject: [PATCH] Add automatic unzipping when updating on Mac. --- CHANGELOG.md | 1 + src/updater.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35f2c01f..eddb5de4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ In this document, Mod is Ctrl on Windows/Linux and Cmd on Mac. ### 1.1.5 (in development) - Swap order of tags and brands in Module Browser. - Disable smoothing for MIDI CC buttons in MIDI-Map. +- Automatically unzip update on Mac. - API - Add libsamplerate library. diff --git a/src/updater.cpp b/src/updater.cpp index 5b2f7a7f..15a93fcc 100644 --- a/src/updater.cpp +++ b/src/updater.cpp @@ -61,16 +61,23 @@ void update() { if (downloadUrl == "") return; -#if defined ARCH_WIN - // Download and launch the installer on Windows +#if defined ARCH_WIN || defined ARCH_MAC + // Download update std::string filename = string::filename(network::urlPath(downloadUrl)); std::string path = asset::user(filename); INFO("Download update %s to %s", downloadUrl.c_str(), path.c_str()); network::requestDownload(downloadUrl, path, &progress); +#endif + +#if defined ARCH_WIN + // Launch the installer INFO("Launching update %s", path.c_str()); system::runProcessDetached(path); +#elif defined ARCH_MAC + // Unzip app using Apple's unzipper, since Rack's unzipper doesn't handle the metadata stuff correctly. + std::string cmd = "open \"" + path + "\""; + std::system(cmd.c_str()); #else - // Open the browser on Mac and Linux. The user will know what to do. system::openBrowser(downloadUrl); #endif