Fix for images loading in help under Windows 46/10246/2
Calixte DENIZET [Fri, 18 Jan 2013 10:40:48 +0000 (11:40 +0100)]
Change-Id: Ia792eba1461a1eb2d9a6ae377ae97315c3f7b52e

scilab/modules/commons/src/java/org/scilab/modules/commons/jarsci/Handler.java

index 12b00d9..24da2b4 100644 (file)
@@ -24,23 +24,23 @@ import org.scilab.modules.commons.ScilabConstants;
  * A {@link URLStreamHandler} that handles images resource.
  */
 public class Handler extends URLStreamHandler {
-    
-    private static String JARPATH = new File(ScilabConstants.SCI, "/modules/helptools/jar/scilab_images.jar").getAbsolutePath();
+
+    private static String JARPATH = new File(ScilabConstants.SCI, "/modules/helptools/jar/scilab_images.jar").getAbsoluteFile().toURI().toString();
 
     public Handler() {
-       
+
     }
 
     @Override
     protected URLConnection openConnection(URL u) throws IOException {
-       String path = u.getPath();
-       if (path.startsWith("./")) {
-           path = path.substring(1);
-       } else {
-           path = "/" + path;
-       }
-
-        URL jar = new URL("jar:file://" + JARPATH + "!" + path);
-       return jar.openConnection();
+        String path = u.getPath();
+        if (path.startsWith("./")) {
+            path = path.substring(1);
+        } else {
+            path = "/" + path;
+        }
+
+        URL jar = new URL("jar:" + JARPATH + "!" + path);
+        return jar.openConnection();
     }
 }