@@ -602,6 +602,7 @@ bool PluginListBoxComponent::loadPluginInfo(const String& pluginName)
602602
603603 selectedPluginInfo.pluginName = pluginName;
604604 selectedPluginInfo.displayName = pluginLabels[pluginName][0 ];
605+ selectedPluginInfo.type = pluginLabels[pluginName][1 ];
605606 selectedPluginInfo.owner = owner;
606607 selectedPluginInfo.latestVersion = latest_version;
607608 selectedPluginInfo.lastUpdated = updated;
@@ -797,7 +798,18 @@ void PluginInfoComponent::buttonClicked(Button* button)
797798 var depReply = JSON::parse (depResponse);
798799 String ver = depReply.getProperty (" name" , " NULL" );
799800
800- downloadPlugin (pInfo.dependencies [i], ver, true );
801+ int retCode = downloadPlugin (pInfo.dependencies [i], ver, true );
802+
803+ if (retCode == 2 )
804+ {
805+ AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon,
806+ " Plugin Installer " + pInfo.dependencies [i],
807+ " Could not install dependency: " + pInfo.dependencies [i]
808+ + " . Please contact the developers." );
809+
810+ std::cout << " Download Failed!!" << std::endl;
811+ return ;
812+ }
801813 }
802814
803815 // download the plugin
@@ -1039,8 +1051,23 @@ int PluginInfoComponent::downloadPlugin(const String& plugin, const String& vers
10391051
10401052 URL fileUrl (fileDownloadURL);
10411053
1054+ int statusC;
1055+ StringPairArray responseHeaders;
1056+
10421057 // Create input stream from the plugin's zip file URL
1043- ScopedPointer<InputStream> fileStream = fileUrl.createInputStream (false );
1058+ ScopedPointer<InputStream> fileStream = fileUrl.createInputStream (false , nullptr , nullptr , String (), 1000 , &responseHeaders, &statusC, 5 , String ());
1059+ String newLocation = responseHeaders.getValue (" Location" , " NULL" );
1060+
1061+ // ZIP URL Location changed, use the new location
1062+ if (newLocation != " NULL" )
1063+ {
1064+ fileUrl = newLocation;
1065+ fileStream = fileUrl.createInputStream (false );
1066+ }
1067+
1068+ // ZIP file empty, return.
1069+ if (fileStream->getTotalLength () == 0 )
1070+ return 0 ;
10441071
10451072 // Get path to plugins directory
10461073 File pluginsPath = getPluginsLocationDirectory ();
@@ -1141,7 +1168,7 @@ int PluginInfoComponent::downloadPlugin(const String& plugin, const String& vers
11411168
11421169 if (rs.failed ())
11431170 {
1144- std::cout << " Uncompressing plugin zip file failed!! " << std::endl;
1171+ std::cout << rs. getErrorMessage () << std::endl;
11451172 return 2 ;
11461173 }
11471174
@@ -1158,7 +1185,8 @@ int PluginInfoComponent::downloadPlugin(const String& plugin, const String& vers
11581185 AccessClass::getProcessorList ()->fillItemList ();
11591186 AccessClass::getProcessorList ()->repaint ();
11601187
1161- AccessClass::getControlPanel ()->updateRecordEngineList ();
1188+ if (pInfo.type == " Record Engine" )
1189+ AccessClass::getControlPanel ()->updateRecordEngineList ();
11621190
11631191 return 1 ;
11641192 }
0 commit comments