@@ -1610,9 +1610,16 @@ int PluginInfoComponent::downloadPlugin (const String& plugin, const String& ver
16101610 fs::path tempPluginPath = tempDir.getChildFile (" plugins" ).getFullPathName ().toStdString ();
16111611 fs::path destPluginPath = getPluginsDirectory ().getFullPathName ().toStdString ();
16121612
1613- // Copy only if plugin file exists
1613+ // Copy only if plugin file exists in temp directory
16141614 if (fs::exists (tempPluginPath))
16151615 {
1616+ // Delete existing plugin DLL file if it exists
1617+ File dllFile = getPluginsDirectory ().getChildFile (dllName);
1618+ if (dllFile.exists ())
1619+ {
1620+ dllFile.deleteRecursively ();
1621+ }
1622+
16161623 const auto copyOptions = fs::copy_options::overwrite_existing
16171624 | fs::copy_options::recursive;
16181625 try
@@ -1647,9 +1654,15 @@ int PluginInfoComponent::downloadPlugin (const String& plugin, const String& ver
16471654 // Copy only if shared files exist
16481655 if (fs::exists (tempSharedPath))
16491656 {
1657+ #ifdef JUCE_WINDOWS || JUCE_MAC
1658+ const auto copyOptions = fs::copy_options::overwrite_existing
1659+ | fs::copy_options::recursive
1660+ | fs::copy_options::copy_symlinks;
1661+ #else
16501662 const auto copyOptions = fs::copy_options::update_existing
16511663 | fs::copy_options::recursive
16521664 | fs::copy_options::copy_symlinks;
1665+ #endif
16531666 try
16541667 {
16551668 fs::copy (tempSharedPath, destSharedPath, copyOptions);
0 commit comments