1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-19 09:42:11 +03:00

ContributionInstaller OS check: MacOSX now uses real arch rather than JVM one

This commit is contained in:
Federico Fissore
2015-03-24 10:15:06 +01:00
parent 8bdd2c9402
commit e646ca2525
9 changed files with 279 additions and 47 deletions

View File

@ -28,6 +28,8 @@
*/
package cc.arduino.contributions.packages;
import processing.app.BaseNoGui;
import java.util.List;
public abstract class ContributedTool {
@ -40,7 +42,7 @@ public abstract class ContributedTool {
public DownloadableContribution getDownloadableContribution() {
for (HostDependentDownloadableContribution c : getSystems()) {
if (c.isCompatible())
if (c.isCompatible(BaseNoGui.getPlatform()))
return c;
}
return null;
@ -52,7 +54,7 @@ public abstract class ContributedTool {
res = "Tool name : " + getName() + " " + getVersion() + "\n";
for (HostDependentDownloadableContribution sys : getSystems()) {
res += " sys";
res += sys.isCompatible() ? "*" : " ";
res += sys.isCompatible(BaseNoGui.getPlatform()) ? "*" : " ";
res += " : " + sys + "\n";
}
return res;

View File

@ -172,7 +172,7 @@ public class ContributionInstaller {
if (postInstallScripts.isEmpty()) {
String[] subfolders = folder.list(new OnlyDirs());
if (subfolders.length > 1) {
if (subfolders.length != 1) {
return;
}

View File

@ -28,7 +28,8 @@
*/
package cc.arduino.contributions.packages;
import java.util.Properties;
import processing.app.BaseNoGui;
import processing.app.Platform;
public abstract class HostDependentDownloadableContribution extends DownloadableContribution {
@ -39,12 +40,9 @@ public abstract class HostDependentDownloadableContribution extends Downloadable
return getHost() + " " + super.toString();
}
public boolean isCompatible() {
// TODO: add missing host detections
Properties prop = System.getProperties();
String osName = prop.getProperty("os.name");
String osArch = prop.getProperty("os.arch");
public boolean isCompatible(Platform platform) {
String osName = platform.getOsName();
String osArch = platform.getOsArch();
String host = getHost();