aboutsummaryrefslogtreecommitdiff
path: root/src/installer/lombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2011-05-09 21:21:33 +0200
committerRoel Spilker <r.spilker@gmail.com>2011-05-09 21:21:33 +0200
commit99b4fac271f77951c3f1c376f31a925ef84f5651 (patch)
treec6a4f1bc48cb991d5df4f900113e5ed9c1e6574f /src/installer/lombok
parent201d9216929fc9fe0a910c4a34765582712cd409 (diff)
downloadlombok-99b4fac271f77951c3f1c376f31a925ef84f5651.tar.gz
lombok-99b4fac271f77951c3f1c376f31a925ef84f5651.tar.bz2
lombok-99b4fac271f77951c3f1c376f31a925ef84f5651.zip
Recurse directories while eclipse or sts is part of the directory name. Solves issue 210.
Diffstat (limited to 'src/installer/lombok')
-rw-r--r--src/installer/lombok/installer/eclipse/EclipseFinder.java42
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();