package org.langmeta
package io

import java.net._
import org.langmeta.internal.io.PathIO

final case class Fragment(base: AbsolutePath, name: RelativePath) {
  def uri: URI = {
    val baseuri = base.toURI.normalize
    if (baseuri.toString.endsWith(".jar")) {
      val reluri = PathIO.toUnix(name.toString)
      new URI(s"jar:$baseuri!/$reluri")
    } else {
      base.resolve(name).toURI.normalize
    }
  }
  def syntax: String = uri.toString
  def structure: String = s"""Fragment(${base.structure}, ${name.structure})"""
  override def toString = syntax
}

package org.langmeta
package io

import java.net._

final case class Fragment(base: AbsolutePath, name: RelativePath) {
  def uri: URI = {
    val baseuri = base.toURI.normalize
    if (baseuri.toString.endsWith(".jar")) new URI(s"jar:$baseuri!/$name")
    else base.resolve(name).toURI.normalize
  }
  def syntax: String = uri.toString
  def structure: String = s"""Fragment(${base.structure}, ${name.structure})"""
  override def toString = syntax
}

--- 
+++ 
@@ -2,12 +2,17 @@
 package io
 
 import java.net._
+import org.langmeta.internal.io.PathIO
 
 final case class Fragment(base: AbsolutePath, name: RelativePath) {
   def uri: URI = {
     val baseuri = base.toURI.normalize
-    if (baseuri.toString.endsWith(".jar")) new URI(s"jar:$baseuri!/$name")
-    else base.resolve(name).toURI.normalize
+    if (baseuri.toString.endsWith(".jar")) {
+      val reluri = PathIO.toUnix(name.toString)
+      new URI(s"jar:$baseuri!/$reluri")
+    } else {
+      base.resolve(name).toURI.normalize
+    }
   }
   def syntax: String = uri.toString
   def structure: String = s"""Fragment(${base.structure}, ${name.structure})"""
Normalize relative path inside jar files for Windows compat.

Path.toString on windows uses backslashes which are invalid in the
relative path section of a jar URI (the part after !/). This commit
converts \ to / in the relative path part.
