1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-31 20:52:13 +01:00

Use latest tools version for generic tool.paths properties

This commit is contained in:
Cristian Maglie 2016-08-02 14:11:12 +02:00
parent 6f24fa6cec
commit 3b57462281

View File

@ -5,6 +5,7 @@ import cc.arduino.Constants;
import cc.arduino.UploaderUtils;
import cc.arduino.contributions.GPGDetachedSignatureVerifier;
import cc.arduino.contributions.SignatureVerificationFailedException;
import cc.arduino.contributions.VersionComparator;
import cc.arduino.contributions.libraries.LibrariesIndexer;
import cc.arduino.contributions.packages.ContributedPlatform;
import cc.arduino.contributions.packages.ContributedTool;
@ -866,6 +867,8 @@ public class BaseNoGui {
PreferencesData.removeAllKeysWithPrefix(prefix);
}
Map<String, String> latestVersions = new HashMap<>();
VersionComparator comparator = new VersionComparator();
for (ContributedTool tool : installedTools) {
File installedFolder = tool.getDownloadableContribution(getPlatform()).getInstalledFolder();
String toolPath;
@ -874,10 +877,15 @@ public class BaseNoGui {
} else {
toolPath = Constants.PREF_REMOVE_PLACEHOLDER;
}
PreferencesData.set(prefix + tool.getName() + ".path", toolPath);
PreferencesData.set(prefix + tool.getName() + "-" + tool.getVersion() + ".path", toolPath);
PreferencesData.set(prefix + tool.getPackager() + "-" + tool.getName() + "-" + tool.getVersion() + ".path",
toolPath);
String toolName = tool.getName();
String toolVersion = tool.getVersion();
PreferencesData.set(prefix + toolName + "-" + toolVersion + ".path", toolPath);
PreferencesData.set(prefix + tool.getPackager() + "-" + toolName + "-" + toolVersion + ".path", toolPath);
// In the generic tool property put the path of the latest version if more are available
if (!latestVersions.containsKey(toolName) || comparator.greaterThan(toolVersion, latestVersions.get(toolName))) {
latestVersions.put(toolName, toolVersion);
PreferencesData.set(prefix + toolName + ".path", toolPath);
}
}
}