diff --git a/plugin.mk b/plugin.mk index 47438416..1c535a34 100644 --- a/plugin.mk +++ b/plugin.mk @@ -24,10 +24,6 @@ LDFLAGS += -L$(RACK_DIR) -lRack include $(RACK_DIR)/arch.mk TARGET := plugin -ifndef ARCH_X64 - # On non-x64, append CPU name to plugin binary - TARGET := $(TARGET)-$(ARCH_CPU) -endif ifdef ARCH_LIN TARGET := $(TARGET).so @@ -52,6 +48,11 @@ 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 DEP_FLAGS += -fPIC include $(RACK_DIR)/dep.mk @@ -88,8 +89,8 @@ endif cd dist && tar -c $(SLUG) | zstd -$(ZSTD_COMPRESSION_LEVEL) -o "$(SLUG)"-"$(VERSION)"-$(ARCH_NAME).vcvplugin install: dist - mkdir -p "$(RACK_USER_DIR)"/plugins/ - cp dist/*.vcvplugin "$(RACK_USER_DIR)"/plugins/ + mkdir -p "$(PLUGINS_DIR)" + cp dist/*.vcvplugin "$(PLUGINS_DIR)"/ .PHONY: clean dist .DEFAULT_GOAL := all diff --git a/src/plugin.cpp b/src/plugin.cpp index 6ea4f97d..d0a882e8 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -103,14 +103,7 @@ static InitCallback loadPluginCallback(Plugin* plugin) { libraryExt = "dylib"; #endif -#if defined ARCH_X64 - // Use `plugin.EXT` on x64 for backward compatibility. - // Change to `plugin-OS-CPU.EXT` in Rack 3. std::string libraryFilename = "plugin." + libraryExt; -#else - // Use `plugin-CPU.EXT` on other CPUs like ARM64 - std::string libraryFilename = "plugin-" + APP_CPU + "." + libraryExt; -#endif std::string libraryPath = system::join(plugin->path, libraryFilename); // Check file existence @@ -260,9 +253,14 @@ void init() { // Load Core loadPlugin(""); - pluginsPath = asset::user("plugins"); - // 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; + } +#endif system::createDirectory(pluginsPath); // Don't load plugins if safe mode is enabled