Skip to content

Commit

Permalink
make some file URIs work on windows
Browse files Browse the repository at this point in the history
basically File.toURI() is broken - it does not produce legal URLs - however nio Path does....
  • Loading branch information
pahjbo committed Aug 14, 2024
1 parent aa6ec34 commit b644e35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class ExternalModelHelper constructor (private val project: Project, private val
""".trimIndent()
)
v.forEach {
out.write(" <uri name=\"${it.name}\" uri=\"${it.toURI().toURL()}\"/>\n")
out.write(" <uri name=\"${it.name}\" uri=\"${java.nio.file.Paths.get(it.toURI()).toUri()}\"/>\n") //IMPL note that the File.toURI() does not produce a legal file: URI!
}
out.write(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import org.gradle.api.tasks.*
import java.io.File
import javax.inject.Inject
import com.fasterxml.jackson.databind.ObjectMapper



import java.nio.file.Paths


/*
Expand Down Expand Up @@ -61,11 +59,15 @@ open class VodmlSchemaTask @Inject constructor(ao1: ArchiveOperations) : VodmlB
outfile.get().asFile.writeText(pretty)
}

val xmlcat = java.nio.file.Paths.get(schemaDir.file("xmlcat.xml").get().asFile.toURI()).toUri().toString()
val jsoncat = java.nio.file.Paths.get(schemaDir.file("jsoncat.txt").get().asFile.toURI()).toUri().toString()
logger.info("generating Catalogues")
logger.info("xml = $xmlcat")
logger.info("json= $jsoncat")
Vodml2Catalogues.doTransform(mapOf(
"binding" to bindingFiles.joinToString(separator = ",") { it.toURI().toURL().toString() },
"xml-catalogue" to schemaDir.file("xmlcat.xml").get().asFile.absolutePath,
"json-catalogue" to schemaDir.file("jsoncat.txt").get().asFile.absolutePath
"xml-catalogue" to xmlcat,
"json-catalogue" to jsoncat

)
)
Expand Down

0 comments on commit b644e35

Please sign in to comment.