Skip to content

Commit 5bf9ac3

Browse files
eviltestereviltester
eviltester
authored and
eviltester
committed
quick hacks to get the pulper running on Windows
had to bump release as well
1 parent b7dc755 commit 5bf9ac3

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

java/pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,17 @@ v1.4 - split into multiple pom.xnl
4242
moved to 1.2 snapshot to work on a v1 to v2 toggle where v2 has ids, classes etc for automating
4343
version 1.2.0 pulper 4 different versions, with help file
4444
version 1.2.1 pulper v5 has an XHTTP request on author create
45+
1.2.2 has operating system independent resource loading i.e. it didn't work on windows
4546
-->
46-
<thepulper.version>1-2-1</thepulper.version>
47+
<thepulper.version>1-2-2</thepulper.version>
4748

4849
<!-- COLLECTED APPS -->
4950
<!-- 1-2-0 has the pulper with CRUD and formatting-->
5051
<!-- 1-3-0 has the pulper with 4 switchable versions with different capabilities as shown in help file-->
5152
<!-- 1-3-1 has the pulper with v5 - fetch javascript create on author
5253
and Selenium Test pages has the search engine page fix for cookies
5354
-->
54-
<collectedapp.version>1-3-1</collectedapp.version>
55+
<collectedapp.version>1-3-2</collectedapp.version>
5556

5657

5758
<herokumaven.version>1.2.0</herokumaven.version>

java/testingapps/thepulper/src/main/java/com/javafortesters/pulp/reader/CsvReader.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ public CsvReader(String resourcePath) {
1111

1212
public void read() {
1313
this.data = new ResourceReader().asString(resourcePath);
14-
this.lines = data.split("\n");
14+
String splitter = "\n";
15+
if(data.contains("\r\n")){
16+
splitter = "\r\n";
17+
}
18+
this.lines = data.split(splitter);
1519
}
1620

1721
public int numberOfLines() {

java/testingapps/thepulper/src/main/java/com/javafortesters/pulp/reader/ResourceReader.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class ResourceReader {
1212
public String asString(String resourceName){
1313

1414
try {
15-
InputStream in = this.getClass().getResourceAsStream(resourceName);
15+
InputStream in = this.getClass().getResourceAsStream(osIndependentResourcePath(resourceName));
1616

1717
// http://web.archive.org/web/20140531042945/https://weblogs.java.net/blog/pat/archive/2004/10/stupid_scanner_1.html
1818
Scanner scanner = new Scanner(in).useDelimiter("\\A");
@@ -29,10 +29,14 @@ public String asString(String resourceName){
2929
}
3030
}
3131

32+
private String osIndependentResourcePath(String path){
33+
return path.replaceAll("\\\\","/");
34+
}
35+
3236
public boolean doesResourceExist(final String path) {
3337
try {
3438

35-
InputStream in = this.getClass().getResourceAsStream(path);
39+
InputStream in = this.getClass().getResourceAsStream(osIndependentResourcePath(path));
3640
if(in==null){
3741
return false;
3842
}

0 commit comments

Comments
 (0)