Skip to content

Commit ff1f397

Browse files
committed
added method to get relative file path & app name
1 parent be0d488 commit ff1f397

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/main/java/entity/FileEntity.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,19 @@ public boolean getHas_androidtestInstrumentationTestCase()
8383
public boolean getHas_orgjunitAssert(){
8484
return imports.get("org.junit.Assert");
8585
}
86+
87+
public String getRelativeFilePath(){
88+
String filePath = path.toAbsolutePath().toString();
89+
String[] splitString = filePath.split("\\\\");
90+
StringBuilder stringBuilder = new StringBuilder();
91+
for (int i = 0; i < 5; i++) {
92+
stringBuilder.append(splitString[i] + "\\");
93+
}
94+
return filePath.substring(stringBuilder.toString().length()).replace("\\","/");
95+
}
96+
97+
public String getAppName(){
98+
String filePath = path.toAbsolutePath().toString();
99+
return filePath.split("\\\\")[3];
100+
}
86101
}

0 commit comments

Comments
 (0)