aboutsummaryrefslogtreecommitdiff
path: root/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/installer/lombok/installer/eclipse/StandardProductDescriptor.java')
-rw-r--r--src/installer/lombok/installer/eclipse/StandardProductDescriptor.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java b/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java
index 47e103aa..9bd3ae94 100644
--- a/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java
+++ b/src/installer/lombok/installer/eclipse/StandardProductDescriptor.java
@@ -21,6 +21,7 @@
*/
package lombok.installer.eclipse;
+import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -34,7 +35,7 @@ import lombok.installer.OsUtils;
public class StandardProductDescriptor implements EclipseProductDescriptor {
private static final String USER_HOME = System.getProperty("user.home", ".");
- private static final String[] WINDOWS_ROOTS = {"\\", "\\Program Files", "\\Program Files (x86)", USER_HOME};
+ private static final String[] WINDOWS_ROOTS = windowsRoots();
private static final String[] MAC_ROOTS = {"/Applications", USER_HOME};
private static final String[] UNIX_ROOTS = {USER_HOME};
@@ -155,4 +156,16 @@ public class StandardProductDescriptor implements EclipseProductDescriptor {
}
return base + pathSeparator + alternative.replaceAll("[\\/]", "\\" + pathSeparator);
}
+
+ private static String[] windowsRoots() {
+ String localAppData = windowsLocalAppData();
+ if (localAppData == null) return new String[] {"\\", "\\Program Files", "\\Program Files (x86)", USER_HOME};
+ return new String[] {"\\", "\\Program Files", "\\Program Files (x86)", USER_HOME, localAppData};
+ }
+
+ private static String windowsLocalAppData() {
+ String localAppData = System.getenv("LOCALAPPDATA");
+ File file = localAppData == null ? null : new File(localAppData);
+ return file != null && file.exists() && file.canRead() && file.isDirectory() ? localAppData : null;
+ }
}