1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Removing previously installed platform on upgrade

This commit is contained in:
Federico Fissore
2015-02-23 12:47:48 +01:00
parent b1e0249a4f
commit fe6718ce4f
7 changed files with 49 additions and 35 deletions

View File

@ -66,7 +66,6 @@ public class LibrariesIndexer {
public void parseIndex() throws JsonParseException, IOException {
parseIndex(indexFile);
System.out.println(index);
index.fillCategories();
// TODO: resolve libraries inner references

View File

@ -60,8 +60,9 @@ public class ContributionInstaller {
}
public void install(ContributedPlatform platform) throws Exception {
if (platform.isInstalled())
if (platform.isInstalled()) {
throw new Exception("Platform is already installed!");
}
// Do not download already installed tools
List<ContributedTool> tools = new LinkedList<ContributedTool>(platform.getResolvedTools());
@ -111,13 +112,11 @@ public class ContributionInstaller {
File toolsFolder = new File(packageFolder, "tools");
int i = 1;
for (ContributedTool tool : platform.getResolvedTools()) {
progress.setStatus(format(_("Installing tools ({0}/{1})..."), i,
tools.size()));
progress.setStatus(format(_("Installing tools ({0}/{1})..."), i, tools.size()));
onProgress(progress);
i++;
DownloadableContribution toolContrib = tool.getDownloadableContribution();
File destFolder = new File(toolsFolder, tool.getName() + File.separator +
tool.getVersion());
File destFolder = new File(toolsFolder, tool.getName() + File.separator + tool.getVersion());
destFolder.mkdirs();
ArchiveExtractor.extract(toolContrib.getDownloadedFile(), destFolder, 1);
@ -129,8 +128,7 @@ public class ContributionInstaller {
// Unpack platform on the correct location
progress.setStatus(_("Installing boards..."));
onProgress(progress);
File platformFolder = new File(packageFolder, "hardware" + File.separator +
platform.getArchitecture());
File platformFolder = new File(packageFolder, "hardware" + File.separator + platform.getArchitecture());
File destFolder = new File(platformFolder, platform.getVersion());
destFolder.mkdirs();
ArchiveExtractor.extract(platform.getDownloadedFile(), destFolder, 1);

View File

@ -612,7 +612,6 @@ public class BaseNoGui {
}
indexer.parseIndex();
indexer.syncWithFilesystem();
System.out.println(indexer);
packages = new HashMap<String, TargetPackage>();
loadHardware(getHardwareFolder());