diff options
-rw-r--r-- | src/installer/lombok/installer/eclipse/EclipseFinder.java | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/installer/lombok/installer/eclipse/EclipseFinder.java b/src/installer/lombok/installer/eclipse/EclipseFinder.java index 4aac1b54..101b6347 100644 --- a/src/installer/lombok/installer/eclipse/EclipseFinder.java +++ b/src/installer/lombok/installer/eclipse/EclipseFinder.java @@ -58,7 +58,7 @@ public class EclipseFinder extends IdeFinder { } protected List<String> getSourceDirsOnWindows() { - return Arrays.asList("\\", "\\Program Files", System.getProperty("user.home", ".")); + return Arrays.asList("\\", "\\Program Files", "\\Program Files (x86)", System.getProperty("user.home", ".")); } protected List<String> getSourceDirsOnMac() { @@ -96,27 +96,35 @@ public class EclipseFinder extends IdeFinder { try { File f = new File(letter + ":" + possibleSource); if (!f.isDirectory()) continue; - for (File dir : f.listFiles()) { - if (!dir.isDirectory()) continue; - try { - if (dir.getName().toLowerCase().contains(getDirName())) { - String eclipseLocation = findEclipseOnWindows1(dir); - if (eclipseLocation != null) { - try { - IdeLocation newLocation = createLocation(eclipseLocation); - if (newLocation != null) locations.add(newLocation); - } catch (CorruptedIdeLocationException e) { - problems.add(e); - } - } - } - } catch (Exception ignore) {} - } + recurseDirectory(locations, problems, f); } catch (Exception ignore) {} } } } + private void recurseDirectory(List<IdeLocation> locations, List<CorruptedIdeLocationException> problems, File f) { + //Various try/catch/ignore statements are in this for loop. Weird conditions on the disk can cause exceptions, + //such as an unformatted drive causing a NullPointerException on listFiles. Best action is almost invariably to just + //continue onwards. + for (File dir : f.listFiles()) { + if (!dir.isDirectory()) continue; + try { + if (dir.getName().toLowerCase().contains(getDirName())) { + String eclipseLocation = findEclipseOnWindows1(dir); + if (eclipseLocation != null) { + try { + IdeLocation newLocation = createLocation(eclipseLocation); + if (newLocation != null) locations.add(newLocation); + } catch (CorruptedIdeLocationException e) { + problems.add(e); + } + } + recurseDirectory(locations, problems, dir); + } + } catch (Exception ignore) {} + } + } + /** Checks if the provided directory contains 'eclipse.exe', and if so, returns the directory, otherwise null. */ private String findEclipseOnWindows1(File dir) { if (new File(dir, getWindowsExecutableName()).isFile()) return dir.getAbsolutePath(); |