From 903873dad2ad2d875608f4cae55a28f3d5b98de0 Mon Sep 17 00:00:00 2001 From: reuk Date: Wed, 19 Jan 2022 12:49:30 +0000 Subject: [PATCH] VST3: Add local search path on Windows We haven't updated the default post-build copy paths yet, as the new local directory is not yet well-supported by DAWs. --- .../format_types/juce_VST3PluginFormat.cpp | 9 ++++---- modules/juce_core/files/juce_File.h | 5 +++- modules/juce_core/native/juce_win32_Files.cpp | 23 ++++++++++--------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index e566f7cc8a..5a392a4746 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -3746,12 +3746,13 @@ void VST3PluginFormat::recursiveFileSearch (StringArray& results, const File& di FileSearchPath VST3PluginFormat::getDefaultLocationsToSearch() { #if JUCE_WINDOWS - auto programFiles = File::getSpecialLocation (File::globalApplicationsDirectory).getFullPathName(); - return FileSearchPath (programFiles + "\\Common Files\\VST3"); + const auto localAppData = File::getSpecialLocation (File::windowsLocalAppData) .getFullPathName(); + const auto programFiles = File::getSpecialLocation (File::globalApplicationsDirectory).getFullPathName(); + return FileSearchPath (localAppData + "\\Programs\\Common\\VST3;" + programFiles + "\\Common Files\\VST3"); #elif JUCE_MAC - return FileSearchPath ("/Library/Audio/Plug-Ins/VST3;~/Library/Audio/Plug-Ins/VST3"); + return FileSearchPath ("~/Library/Audio/Plug-Ins/VST3;/Library/Audio/Plug-Ins/VST3"); #else - return FileSearchPath ("/usr/lib/vst3/;/usr/local/lib/vst3/;~/.vst3/"); + return FileSearchPath ("~/.vst3/;/usr/lib/vst3/;/usr/local/lib/vst3/"); #endif } diff --git a/modules/juce_core/files/juce_File.h b/modules/juce_core/files/juce_File.h index ac38105ea6..aa5a2ef3f5 100644 --- a/modules/juce_core/files/juce_File.h +++ b/modules/juce_core/files/juce_File.h @@ -942,7 +942,10 @@ public: @see globalApplicationsDirectory */ - globalApplicationsDirectoryX86 + globalApplicationsDirectoryX86, + + /** On a Windows machine returns the %LOCALAPPDATA% folder. */ + windowsLocalAppData #endif }; diff --git a/modules/juce_core/native/juce_win32_Files.cpp b/modules/juce_core/native/juce_win32_Files.cpp index b9628eb136..b8ab52ca79 100644 --- a/modules/juce_core/native/juce_win32_Files.cpp +++ b/modules/juce_core/native/juce_win32_Files.cpp @@ -618,17 +618,18 @@ File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType type) switch (type) { - case userHomeDirectory: csidlType = CSIDL_PROFILE; break; - case userDocumentsDirectory: csidlType = CSIDL_PERSONAL; break; - case userDesktopDirectory: csidlType = CSIDL_DESKTOP; break; - case userApplicationDataDirectory: csidlType = CSIDL_APPDATA; break; - case commonApplicationDataDirectory: csidlType = CSIDL_COMMON_APPDATA; break; - case commonDocumentsDirectory: csidlType = CSIDL_COMMON_DOCUMENTS; break; - case globalApplicationsDirectory: csidlType = CSIDL_PROGRAM_FILES; break; - case globalApplicationsDirectoryX86: csidlType = CSIDL_PROGRAM_FILESX86; break; - case userMusicDirectory: csidlType = 0x0d; /*CSIDL_MYMUSIC*/ break; - case userMoviesDirectory: csidlType = 0x0e; /*CSIDL_MYVIDEO*/ break; - case userPicturesDirectory: csidlType = 0x27; /*CSIDL_MYPICTURES*/ break; + case userHomeDirectory: csidlType = CSIDL_PROFILE; break; + case userDocumentsDirectory: csidlType = CSIDL_PERSONAL; break; + case userDesktopDirectory: csidlType = CSIDL_DESKTOP; break; + case userApplicationDataDirectory: csidlType = CSIDL_APPDATA; break; + case commonApplicationDataDirectory: csidlType = CSIDL_COMMON_APPDATA; break; + case commonDocumentsDirectory: csidlType = CSIDL_COMMON_DOCUMENTS; break; + case globalApplicationsDirectory: csidlType = CSIDL_PROGRAM_FILES; break; + case globalApplicationsDirectoryX86: csidlType = CSIDL_PROGRAM_FILESX86; break; + case windowsLocalAppData: csidlType = CSIDL_LOCAL_APPDATA; break; + case userMusicDirectory: csidlType = 0x0d; /*CSIDL_MYMUSIC*/ break; + case userMoviesDirectory: csidlType = 0x0e; /*CSIDL_MYVIDEO*/ break; + case userPicturesDirectory: csidlType = 0x27; /*CSIDL_MYPICTURES*/ break; case tempDirectory: {