Fixing reading files in sbt 1.4+ subprojects

This commit is contained in:
Matthias Kurz committed 2020-12-05 18:03:45 +01:00
1 parent 321727559f
commit 02e3101a0b
1 file changed
+8 -1
+8 -1
View File
@@ -174,7 +174,14 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
if (sbtMappedVirtualFileRootsField == null) return null;
String encodedPath = (String) sbtMappedVirtualFilePathField.get(mappedVirtualFile);
if (!encodedPath.startsWith("${")) return null;
if (!encodedPath.startsWith("${")) {
File maybeAbsoluteFile = new File(encodedPath);
if (maybeAbsoluteFile.exists()) {
return maybeAbsoluteFile.toURI();
} else {
return null;
}
}
int idx = encodedPath.indexOf('}');
if (idx == -1) return null;
String base = encodedPath.substring(2, idx);