Skip to content

Commit 3e4afa1

Browse files
author
David Baum
committed
get path in a way it works on Windows and Linux
1 parent bc95a47 commit 3e4afa1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • generator2/org.getaviz.generator/src/test/java/org/getaviz/generator/mockups

generator2/org.getaviz.generator/src/test/java/org/getaviz/generator/mockups/Mockup.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.getaviz.generator.mockups;
22

3+
import java.io.File;
34
import java.io.IOException;
45
import java.io.UnsupportedEncodingException;
56
import java.net.URLDecoder;
@@ -46,13 +47,15 @@ protected void resetDatabase () {
4647

4748
protected void runCypherScript (String resource) {
4849
ClassLoader classLoader = this.getClass().getClassLoader();
49-
String path = classLoader.getResource(resource).getPath();
50+
String filePath = classLoader.getResource(resource).getFile();
51+
File file = new File(filePath);
52+
String path = file.getAbsolutePath();
5053
try {
5154
path = URLDecoder.decode(path, "UTF-8");
5255
} catch (UnsupportedEncodingException e) {
5356
e.printStackTrace();
5457
}
55-
byte[] encoded = null;
58+
byte[] encoded;
5659
try {
5760
encoded = Files.readAllBytes(Paths.get(path));
5861
connector.executeWrite(new String(encoded));

0 commit comments

Comments
 (0)