Giter Site home page Giter Site logo

URISyntaxException about paradox HOT 6 CLOSED

lightbend avatar lightbend commented on September 13, 2024
URISyntaxException

from paradox.

Comments (6)

drewhk avatar drewhk commented on September 13, 2024

One issue is with relativeRootPath, that can be fixed like this

  /**
   * Normalize the path to Unix style root path. Removes drive letter and appends the "/" symbol. Also converts
   * backslashes to slashes.
   */
  def toUnixStyleRootPath(pathString: String): String = toUnixStyleRootPath(Paths.get(pathString))

  /**
   * Normalize the path to Unix style root path. Removes drive letter and appends the "/" symbol. Also converts
   * backslashes to slashes.
   */
  def toUnixStyleRootPath(path: Path): String = {
    val fullPathWithDriveLetter = path.toAbsolutePath

    val fullPathString =
      if (fullPathWithDriveLetter.getRoot ne null)
        "\\" + fullPathWithDriveLetter.getRoot.relativize(fullPathWithDriveLetter).toString
      else
        fullPathWithDriveLetter.toString

    fullPathString.replace(File.separatorChar, '/')
  }

  /**
   * Provide the relative root path from a local path related to a full path
   */
  def relativeRootPath(file: File, localPath: String): String = {
    val pathString = toUnixStyleRootPath(file.toPath)
    if (pathString.endsWith(localPath)) pathString.dropRight(localPath.length) else pathString
  }

from paradox.

drewhk avatar drewhk commented on September 13, 2024

Also update

  /**
   * Provide the local path given the root path and the full path
   */
  def relativeLocalPath(rootPath: String, fullPath: String): String = {
    val root = new URI(toUnixStyleRootPath(rootPath))
    val full = new URI(toUnixStyleRootPath(fullPath))
    root.relativize(full).toString
  }

from paradox.

drewhk avatar drewhk commented on September 13, 2024

Fixed one more bug. I have no push rights, and I am too lazy to clone, so I just send you a patch.

Fix__42_and_other_Windows_lang_issues.patch.txt

from paradox.

drewhk avatar drewhk commented on September 13, 2024

Please release a new version soon, so I can use that as a dependency in Akka instead of my local SNAPSHOT.

from paradox.

eed3si9n avatar eed3si9n commented on September 13, 2024

0.2.6 is on its way to Maven Central

from paradox.

drewhk avatar drewhk commented on September 13, 2024

Great, thanks!

from paradox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.