Skip to content

Commit f832ea1

Browse files
committed
fix tests
Signed-off-by: Stefan Niederhauser <[email protected]>
1 parent fc73611 commit f832ea1

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

graphviz-java/src/main/java/guru/nidi/graphviz/engine/Options.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import static guru.nidi.graphviz.engine.GraphvizLoader.readAsBytes;
2929
import static guru.nidi.graphviz.engine.StringFunctions.replaceNonWordChars;
3030
import static guru.nidi.graphviz.engine.TempFiles.tempDir;
31-
import static guru.nidi.graphviz.service.SystemUtils.relativeUriPathOf;
3231
import static guru.nidi.graphviz.service.SystemUtils.uriPathOf;
3332
import static java.lang.Integer.parseInt;
3433
import static java.util.Locale.ENGLISH;
@@ -148,7 +147,7 @@ public String originalImagePath(String processPath) {
148147
private String completePath(String path) {
149148
return isUrl(path) || new File(path).isAbsolute() || basedir.getPath().equals(".")
150149
? path
151-
: relativeUriPathOf(new File(basedir, path).getPath());
150+
: uriPathOf(new File(basedir, path).getPath());
152151
}
153152

154153
static boolean isUrl(String path) {
@@ -219,9 +218,9 @@ static Image create(String path, String completePath) {
219218
final OutputStream out = new FileOutputStream(file)) {
220219
out.write(readAsBytes(in));
221220
}
222-
System.out.println("******************" + file + " " + file.exists());
223221
final BufferedImage image = ImageIO.read(file);
224-
return new Image(path, file.getAbsolutePath(), image.getWidth(), image.getHeight());
222+
System.out.println("******************" + file + " " + uriPathOf(file) + " " + file.exists() + " " + image.getWidth());
223+
return new Image(path, uriPathOf(file), image.getWidth(), image.getHeight());
225224
}
226225
final BufferedImage image = ImageIO.read(new File(completePath));
227226
return new Image(completePath, uriPathOf(new File(completePath)), image.getWidth(), image.getHeight());

graphviz-java/src/main/java/guru/nidi/graphviz/service/SystemUtils.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ public static Path pathOf(String path) {
6969
return Paths.get(IS_OS_WINDOWS ? path.replace("\"", "") : path);
7070
}
7171

72-
public static String relativeUriPathOf(String path) {
73-
return IS_OS_WINDOWS ? path.replace('\\', '/') : path;
74-
}
75-
7672
public static String uriPathOf(String path) {
77-
return IS_OS_WINDOWS ? "/" + path.replace('\\', '/') : path;
73+
if (IS_OS_WINDOWS) {
74+
return (path.substring(1, 3).equals(":\\") ? "/" : "") + path.replace('\\', '/');
75+
}
76+
return path;
7877
}
7978

8079
public static String uriPathOf(File path) {

0 commit comments

Comments
 (0)