Merge pull request #2668 from mkurz/fix-sbt-subprojects

Fixing reading files in sbt 1.4+ subprojects
This commit is contained in:
Reinier Zwitserloot authored and GitHub committed 2020-12-10 17:23:52 +01:00
commit c14aa6a698
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);