Bug 473897 - Cannot run image under Windows

The host path mount must be converted to Unix-style path before starting
the container.

Change-Id: I9e2456a916c3b63160d7f62357d1cf6fe3bbed0e
Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
Reviewed-on: https://git.eclipse.org/r/52867
Tested-by: Hudson CI
Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageRun.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageRun.java
index 09dde9b..f439182 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageRun.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImageRun.java
@@ -18,6 +18,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.linuxtools.docker.core.DockerException;
@@ -152,13 +153,12 @@
 
 			switch (dataVolume.getMountType()) {
 			case HOST_FILE_SYSTEM:
+				String bind = convertToUnixPath(dataVolume.getHostPathMount())
+						+ ':' + dataVolume.getContainerPath();
 				if (dataVolume.isReadOnly()) {
-					binds.add(dataVolume.getHostPathMount() + ':'
-							+ dataVolume.getContainerPath() + ':' + "ro");
-				} else {
-					binds.add(dataVolume.getHostPathMount() + ':'
-							+ dataVolume.getContainerPath());
+					bind += ':' + "ro";
 				}
+				binds.add(bind);
 				break;
 			case CONTAINER:
 				volumesFrom.add(dataVolume.getContainerMount());
@@ -174,6 +174,19 @@
 		return hostConfigBuilder.build();
 	}
 
+	private String convertToUnixPath(String path) {
+		String unixPath = path;
+
+		if (Platform.getOS() == Platform.OS_WIN32) {
+			unixPath = path.replaceAll("\\\\", "/").replaceFirst("\\:", "");
+			if (!unixPath.startsWith("/")) {
+				unixPath = '/' + unixPath;
+			}
+		}
+
+		return unixPath;
+	}
+
 	@SuppressWarnings("unchecked")
 	public DockerContainerConfig getDockerContainerConfig() {
 		final ImageRunSelectionModel selectionModel = this.imageRunSelectionPage