Fix: Do not execute androidide-cleaner during installation if JAVA_HOME does not exist

This commit is contained in:
Akash Yadav
2022-01-21 12:34:03 +05:30
parent 6340e20416
commit 92526a5d9f
2 changed files with 13 additions and 2 deletions
@@ -208,8 +208,10 @@ public class DownloadActivity extends StudioActivity {
sb.append ("echo 'Cleaning unsupported flags in binaries...'");
joiner (sb);
sb.append ("$BUSYBOX find $JAVA_HOME -type f -exec androidide-cleaner {} \\;");
joiner (sb);
if (Environment.JAVA_HOME.exists ()) {
sb.append ("$BUSYBOX find $JAVA_HOME -type f -exec androidide-cleaner {} \\;");
joiner (sb);
}
String DONE = "DONE";
sb.append ("echo ").append (DONE);
@@ -17,6 +17,7 @@
package com.itsaky.lsp.java.visitors;
import com.itsaky.androidide.utils.Logger;
import com.sun.source.tree.CaseTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.ErroneousTree;
@@ -82,6 +83,12 @@ public class FindCompletionsAt extends TreePathScanner<TreePath, Long> {
@Override
public TreePath visitCase (CaseTree t, Long find) {
SourcePositions pos = Trees.instance (task).getSourcePositions ();
// default statements have null expression
// if (t.getExpression () != null) {
//
// }
long start = pos.getStartPosition (root, t) + "case".length ();
long end = pos.getEndPosition (root, t.getExpression ());
if (start <= find && find <= end) {
@@ -122,4 +129,6 @@ public class FindCompletionsAt extends TreePathScanner<TreePath, Long> {
}
return b;
}
private static final Logger LOG = Logger.instance ("FindCompletionsAt");
}