Skip to content

Commit

Permalink
minor tweaks to #698
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrthomas committed Mar 16, 2019
1 parent ffa4ae7 commit 547aee5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions karate-core/src/main/java/com/intuit/karate/FileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class FileUtils {
private static final String CLASSPATH = "classpath";

public static final String CLASSPATH_COLON = CLASSPATH + ":";
private static final String DOT_FEATURE = ".feature";
public static final String THIS_COLON = "this:";
public static final String FILE_COLON = "file:";
public static final String SRC_TEST_JAVA = "src/test/java";
Expand Down Expand Up @@ -198,18 +199,18 @@ public static InputStream getFileStream(String path, ScenarioContext context) {

public static String toPackageQualifiedName(String path) {
path = removePrefix(path);
path = path.replace("/", "."); // for non windows path
if (path.contains(":\\")) { // to remove driver letter and colon
path = path.replace('/', '.');
if (path.contains(":\\")) { // to remove windows drive letter and colon
path = removePrefix(path);
}
if (path.contains("\\")) { // for \ windows path
path = path.replace("\\",".");
if (path.indexOf('\\') != -1) { // for windows paths
path = path.replace('\\', '.');
}
String packagePath = path.replace("..", "");
String packagePath = path.replace("..", "");
if (packagePath.startsWith(".")) {
packagePath = packagePath.substring(1);
}
if (packagePath.endsWith(".feature")) {
if (packagePath.endsWith(DOT_FEATURE)) {
packagePath = packagePath.substring(0, packagePath.length() - 8);
}
return packagePath;
Expand Down

0 comments on commit 547aee5

Please sign in to comment.