mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Assuming the bundled version is an AVR bundle, force unpacking the default package if it's missing
This commit is contained in:
@ -578,11 +578,12 @@ public class BaseNoGui {
|
||||
static public void initPackages() throws Exception {
|
||||
indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder());
|
||||
File indexFile = indexer.getIndexFile();
|
||||
if (!indexFile.isFile()) {
|
||||
File avrCoreFolder = FileUtils.newFile(indexFile.getParentFile(), "packages", "arduino", "hardware", "avr");
|
||||
if (!indexFile.isFile() || !(avrCoreFolder.exists() && avrCoreFolder.isDirectory())) {
|
||||
File distFile = findDefaultPackageFile();
|
||||
if (distFile != null) {
|
||||
ArchiveExtractor.extract(distFile, BaseNoGui.getSettingsFolder(), 0);
|
||||
} else {
|
||||
ArchiveExtractor.extract(distFile, BaseNoGui.getSettingsFolder(), 0, true);
|
||||
} else if (!indexFile.isFile()) {
|
||||
// Otherwise create an empty packages index
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
|
@ -73,11 +73,13 @@ public class FileUtils {
|
||||
}
|
||||
|
||||
public static void recursiveDelete(File file) {
|
||||
if (file == null)
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
for (File current : file.listFiles())
|
||||
for (File current : file.listFiles()) {
|
||||
recursiveDelete(current);
|
||||
}
|
||||
}
|
||||
file.delete();
|
||||
}
|
||||
@ -254,5 +256,14 @@ public class FileUtils {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static File newFile(File parent, String... parts) {
|
||||
File result = parent;
|
||||
for (String part : parts) {
|
||||
result = new File(result, part);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user