From 5fc633a360fe9752da282c8348142b30252e2cf3 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Mon, 9 Sep 2019 07:40:03 +0200 Subject: [PATCH] Improve Windows deployment. --- .../argeo/osgi/boot/a2/ProvisioningManager.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/org.argeo.osgi.boot/src/org/argeo/osgi/boot/a2/ProvisioningManager.java b/org.argeo.osgi.boot/src/org/argeo/osgi/boot/a2/ProvisioningManager.java index e7a297077..8fb8b2f4d 100644 --- a/org.argeo.osgi.boot/src/org/argeo/osgi/boot/a2/ProvisioningManager.java +++ b/org.argeo.osgi.boot/src/org/argeo/osgi/boot/a2/ProvisioningManager.java @@ -1,5 +1,6 @@ package org.argeo.osgi.boot.a2; +import java.io.File; import java.io.InputStream; import java.net.URI; import java.nio.file.Path; @@ -59,7 +60,11 @@ public class ProvisioningManager { URI u = new URI(uri); if ("a2".equals(u.getScheme())) { if (u.getHost() == null || "".equals(u.getHost())) { - Path base = Paths.get(u.getPath()); + String baseStr = u.getPath(); + if (File.separatorChar == '\\') {// MS Windows + baseStr = baseStr.substring(1).replace('/', File.separatorChar); + } + Path base = Paths.get(baseStr); FsA2Source source = new FsA2Source(base); source.load(); addSource(source); @@ -78,7 +83,10 @@ public class ProvisioningManager { Path frameworkPath = Paths.get(frameworkLocationUri); if (frameworkPath.getParent().getFileName().toString().equals(A2Contribution.BOOT)) { Path base = frameworkPath.getParent().getParent(); - URI baseUri = new URI("a2", null, null, 0, base.toString(), null, null); + String baseStr = base.toString(); + if (File.separatorChar == '\\')// MS Windows + baseStr = '/' + baseStr.replace(File.separatorChar, '/'); + URI baseUri = new URI("a2", null, null, 0, baseStr, null, null); registerSource(baseUri.toString()); OsgiBootUtils.info("Registered " + baseUri + " as default source"); return true; @@ -121,7 +129,7 @@ public class ProvisioningManager { } } } catch (Exception e) { - OsgiBootUtils.error("Could not install module " + module, e); + OsgiBootUtils.error("Could not install module " + module + ": " + e.getMessage(), null); } return null; } -- 2.30.2