[ https://jira.codehaus.org/browse/JBEHAVE-763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=296337#comment-296337 ]
Ricardo Lopez commented on JBEHAVE-763: --------------------------------------- With wiki markup.. Im invoking the code as.. {code} public Configuration configuration() { return new MostUsefulConfiguration() // where to find the stories .useStoryLoader(new LoadFromRelativeFile(CodeLocations.codeLocationFromClass(getClass()), LoadFromRelativeFile.mavenModuleTestStoryFilePath("src/test/resources/jbehave/"))) .useStoryReporterBuilder( new StoryReporterBuilder().withDefaultFormats() .withFormats(Format.CONSOLE, Format.TXT)); {code} The code that breaks in LoadFromRelativeFile that break is {code:title=LoadFromRelativeFile.java} String locationPath = new File(CodeLocations.getPathFromURL(location)).getAbsolutePath(); for (StoryFilePath traversal : traversals) { String filePath = locationPath.replace(traversal.toRemove, traversal.relativePath) + "/" + resourcePath; {code} locationPath would have all '/' converted to '\' by getAbsolutePath on windows machines. Maybe the following line should be inserted after the definition of locationPath {code} locationPath = locationPath.replace("\\","/"); {code} > LoadFromRelativeFile break on windows when using maven traversal > ---------------------------------------------------------------- > > Key: JBEHAVE-763 > URL: https://jira.codehaus.org/browse/JBEHAVE-763 > Project: JBehave > Issue Type: Bug > Components: Core > Affects Versions: 3.6.1 > Environment: Windows Vista > Reporter: Ricardo Lopez > > When invoking LoadFromRelativeFile and passing in a traversal substitution > stories are not found because the substitution is not applied. This is due > to the difference in the StoryFilePath which forces path separators to be > '/'. When the LoadFromRelativeFile code gets the absolute path of location > file separators are converted to '\'. This keeps the locationPath.replace > code from working > Im invoking the code as.. > public Configuration configuration() { > return new MostUsefulConfiguration() // where to find the > stories > .useStoryLoader(new > LoadFromRelativeFile(CodeLocations.codeLocationFromClass(getClass()), > LoadFromRelativeFile.mavenModuleTestStoryFilePath("src/test/resources/jbehave/"))) > .useStoryReporterBuilder( > new > StoryReporterBuilder().withDefaultFormats() > > .withFormats(Format.CONSOLE, Format.TXT)); > The code that breaks in LoadFromRelativeFile that break is > String locationPath = new > File(CodeLocations.getPathFromURL(location)).getAbsolutePath(); > for (StoryFilePath traversal : traversals) { > String filePath = locationPath.replace(traversal.toRemove, > traversal.relativePath) + "/" + resourcePath; > locationPath would have all '/' converted to '\' by getAbsolutePath on > windows machines. > Maybe the following line should be inserted after the definition of > locationPath > locationPath = locationPath.replace("\\","/"); > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email