From c8c99d2292a525d6a0ea0b5ad45d6e794fd27db7 Mon Sep 17 00:00:00 2001
From: Robert Scott <code@humanleg.org.uk>
Date: Tue, 21 Aug 2018 23:20:29 +0100
Subject: [PATCH v1 2/2] PluginServer: ensure jar relative path is stringified
with forward-slashes even on windows
as we're going to be joining it into a url
---
test/unit/org/openstreetmap/josm/testutils/PluginServer.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/test/unit/org/openstreetmap/josm/testutils/PluginServer.java b/test/unit/org/openstreetmap/josm/testutils/PluginServer.java
index 79543e4f5..a8aceb2ca 100644
a
|
b
|
import com.github.tomakehurst.wiremock.client.WireMock; |
25 | 25 | import com.github.tomakehurst.wiremock.core.Options; |
26 | 26 | import com.github.tomakehurst.wiremock.junit.WireMockRule; |
27 | 27 | import com.google.common.collect.ImmutableList; |
| 28 | import com.google.common.collect.Streams; |
28 | 29 | |
29 | 30 | public class PluginServer { |
30 | 31 | public static class RemotePlugin { |
… |
… |
public class PluginServer { |
117 | 118 | final Path filesRootPath = new File(TestUtils.getTestDataRoot()).toPath().toAbsolutePath().resolve("__files").normalize(); |
118 | 119 | |
119 | 120 | if (jarPath.startsWith(filesRootPath)) { |
120 | | return filesRootPath.relativize(jarPath).toString(); |
| 121 | // would just use .toString() but need to force use of *forward slash* path separators on all platforms |
| 122 | return Streams.stream(filesRootPath.relativize(jarPath)).map(p -> p.toString()).collect(Collectors.joining("/")); |
121 | 123 | } |
122 | 124 | } |
123 | 125 | return null; |