mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 18:18:48 +00:00
Recurse directories while eclipse or sts is part of the directory name. Solves issue 210.
This commit is contained in:
1 parent
201d921692
commit
99b4fac271
1 file changed
+25
-17
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user