From 8f5f8992fb00dc3d6d98190238752c51a468aaf8 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Fri, 12 Nov 2021 16:43:05 -0500 Subject: [PATCH] Remove old /tmp/Rack2 symbolic link before creating it. --- src/plugin.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugin.cpp b/src/plugin.cpp index a4e041b3..a0163c3c 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -54,9 +54,11 @@ static void* loadLibrary(std::string libraryPath) { #else // Since Rack 2, plugins on Linux/Mac link to the absolute path /tmp/Rack2/libRack. // Create a symlink at /tmp/Rack2 to the system dir containting libRack. + std::string systemDir = system::getAbsolute(asset::systemDir); + std::string linkPath = "/tmp/Rack2"; if (!settings::devMode) { - std::string systemDir = system::getAbsolute(asset::systemDir); - std::string linkPath = "/tmp/Rack2"; + // Clean up old symbolic link in case a different edition was run earlier + system::remove(linkPath); system::createSymbolicLink(systemDir, linkPath); } // Load library with dlopen