Update getTargetNameFromTemplatesFileName() to also work on Windows systems

This commit is contained in:
Sam Harwell 2015-06-23 01:22:35 -05:00 committed by parrt
parent 5494e7c73e
commit 9247334a07
1 changed files with 2 additions and 3 deletions

View File

@ -282,9 +282,8 @@ public class TestGenerator {
public String getTargetNameFromTemplatesFileName() { public String getTargetNameFromTemplatesFileName() {
// runtimeTemplates is like /Users/parrt/antlr/code/antlr4/tool/test/org/antlr/v4/test/runtime/java/Java.test.stg // runtimeTemplates is like /Users/parrt/antlr/code/antlr4/tool/test/org/antlr/v4/test/runtime/java/Java.test.stg
// extra target name // extra target name
int targetEnd = runtimeTemplates.getPath().indexOf(".test.stg"); int targetEnd = runtimeTemplates.getName().indexOf(".test.stg");
String targetAtEnd = runtimeTemplates.getPath().substring(0, targetEnd); return runtimeTemplates.getName().substring(0, targetEnd);
return targetAtEnd.substring(targetAtEnd.lastIndexOf('/') + 1);
} }
public File getOutputDir(String templateFolder) { public File getOutputDir(String templateFolder) {