commit f804dd61bd24e9610c083197520d3ac5d8919d77
Author:     Mauro Talevi <mauro.tal...@aquilonia.org>
AuthorDate: Sat Apr 14 12:43:50 2012 +0200
Commit:     Mauro Talevi <mauro.tal...@aquilonia.org>
CommitDate: Sat Apr 14 12:43:50 2012 +0200

    JBEHAVE-763:  Normalise paths to use '/'

diff --git 
a/jbehave-core/src/main/java/org/jbehave/core/io/LoadFromRelativeFile.java 
b/jbehave-core/src/main/java/org/jbehave/core/io/LoadFromRelativeFile.java
index 8f6c9ec..3573ff3 100755
--- a/jbehave-core/src/main/java/org/jbehave/core/io/LoadFromRelativeFile.java
+++ b/jbehave-core/src/main/java/org/jbehave/core/io/LoadFromRelativeFile.java
@@ -49,7 +49,7 @@ public class LoadFromRelativeFile implements ResourceLoader, 
StoryLoader {
     
     public String loadResourceAsText(String resourcePath) {
         List<String> traversalPaths = new ArrayList<String>();
-        String locationPath = new 
File(CodeLocations.getPathFromURL(location)).getAbsolutePath();
+        String locationPath = normalise(new 
File(CodeLocations.getPathFromURL(location)).getAbsolutePath());
         for (StoryFilePath traversal : traversals) {
             String filePath = locationPath.replace(traversal.toRemove, 
traversal.relativePath) + "/" + resourcePath;
             File file = new File(filePath);
@@ -85,6 +85,10 @@ public class LoadFromRelativeFile implements ResourceLoader, 
StoryLoader {
         }
     }
 
+    private static String normalise(String path) {
+        return path.replace('\\', '/');
+    }
+
     /**
      * For use the the varargs constructor of {@link LoadFromRelativeFile}, to
      * allow a range of possibilities for locating Story file paths
@@ -94,9 +98,10 @@ public class LoadFromRelativeFile implements ResourceLoader, 
StoryLoader {
         private final String relativePath;
 
         public StoryFilePath(String toRemove, String relativePath) {
-            this.toRemove = toRemove.replace('\\', '/');
-            this.relativePath = relativePath.replace('\\', '/');
+            this.toRemove = normalise(toRemove);
+            this.relativePath = normalise(relativePath);
         }
+
     }
 
     /**



Reply via email to