From aeedc29c5dd592db91c823789fb33d57f23d3fed Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Fri, 13 Oct 2017 21:40:26 -0400 Subject: [PATCH] Fix Mac rtaudio dylib in bundle, properly load plugin after downloading --- Makefile | 4 ++-- src/plugin.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index df755c72..bdfb24e3 100644 --- a/Makefile +++ b/Makefile @@ -98,7 +98,7 @@ ifeq ($(ARCH), mac) cp dep/lib/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/ cp dep/lib/libzip.5.dylib $(BUNDLE)/Contents/MacOS/ cp dep/lib/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/ - cp dep/lib/librtmidi.dylib $(BUNDLE)/Contents/MacOS/ + cp dep/lib/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/ install_name_tool -change /usr/local/lib/libGLEW.2.1.0.dylib @executable_path/libGLEW.2.1.0.dylib $(BUNDLE)/Contents/MacOS/Rack install_name_tool -change lib/libglfw.3.dylib @executable_path/libglfw.3.dylib $(BUNDLE)/Contents/MacOS/Rack @@ -107,7 +107,7 @@ ifeq ($(ARCH), mac) install_name_tool -change $(PWD)/dep/lib/libcurl.4.dylib @executable_path/libcurl.4.dylib $(BUNDLE)/Contents/MacOS/Rack install_name_tool -change $(PWD)/dep/lib/libzip.5.dylib @executable_path/libzip.5.dylib $(BUNDLE)/Contents/MacOS/Rack install_name_tool -change $(PWD)/dep/lib/libportaudio.2.dylib @executable_path/libportaudio.2.dylib $(BUNDLE)/Contents/MacOS/Rack - install_name_tool -change @rpath/librtmidi.dylib @executable_path/librtmidi.dylib $(BUNDLE)/Contents/MacOS/Rack + install_name_tool -change $(PWD)/dep/lib/librtmidi.4.dylib @executable_path/librtmidi.4.dylib $(BUNDLE)/Contents/MacOS/Rack otool -L $(BUNDLE)/Contents/MacOS/Rack diff --git a/src/plugin.cpp b/src/plugin.cpp index abad1575..3de1457b 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -213,16 +213,17 @@ static void refreshPurchase(json_t *pluginJ) { // Download zip std::string pluginsDir = assetLocal("plugins"); - std::string filename = pluginsDir + "/" + slug + ".zip"; - bool success = requestDownload(url, filename, &downloadProgress); + std::string pluginPath = pluginsDir + "/" + slug; + std::string zipPath = pluginPath + ".zip"; + bool success = requestDownload(url, zipPath, &downloadProgress); if (success) { // Unzip file - int err = extractZip(filename.c_str(), pluginsDir.c_str()); + int err = extractZip(zipPath.c_str(), pluginsDir.c_str()); if (!err) { - // Load plugin - loadPlugin(slug); // Delete zip - remove(filename.c_str()); + remove(zipPath.c_str()); + // Load plugin + loadPlugin(pluginPath); } }