From 58d5c06ab7315187cb0eb49cf3125041551b7c73 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 6 Aug 2023 19:06:59 -0400 Subject: [PATCH] Use "plugins-OS-CPU" plugins dir on all arches. On x64, rename old "plugins" dir to new dir. --- plugin.mk | 6 +----- src/plugin.cpp | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/plugin.mk b/plugin.mk index 1c535a34..15e77530 100644 --- a/plugin.mk +++ b/plugin.mk @@ -48,11 +48,7 @@ ifdef ARCH_WIN RACK_USER_DIR ?= $(USERPROFILE)/Documents/Rack2 endif -PLUGINS_DIR := $(RACK_USER_DIR)/plugins -ifndef ARCH_X64 - # On non-x64, append CPU name to plugins dir - PLUGINS_DIR := $(PLUGINS_DIR)-$(ARCH_CPU) -endif +PLUGINS_DIR := $(RACK_USER_DIR)/plugins-$(ARCH_OS)-$(ARCH_CPU) DEP_FLAGS += -fPIC include $(RACK_DIR)/dep.mk diff --git a/src/plugin.cpp b/src/plugin.cpp index d0a882e8..31154402 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -254,13 +254,22 @@ void init() { loadPlugin(""); // Get user plugins directory - pluginsPath = asset::user("plugins"); - // Use `plugins-CPU` dir on non-x64 platforms -#if !defined ARCH_X64 - if (!settings::devMode) { - pluginsPath += "-" + APP_CPU; + if (settings::devMode) { + pluginsPath = asset::user("plugins"); + } + else { + pluginsPath = asset::user("plugins-" + APP_OS + "-" + APP_CPU); + } + + // In Rack <2.4.0, plugins dir was "plugins" regardless of arch. + // Rename old dir if running x64. +#if defined ARCH_X64 + std::string oldPluginsPath = asset::user("plugins"); + if (system::isDirectory(oldPluginsPath)) { + system::rename(oldPluginsPath, pluginsPath); } #endif + system::createDirectory(pluginsPath); // Don't load plugins if safe mode is enabled