Skip to content

Commit

Permalink
Fix mixin index.d.ts on Windows (#73)
Browse files Browse the repository at this point in the history
Paths inside zip-files are unix-style, so we should not compare with Windows-style paths there.

Closes: #71
  • Loading branch information
tajakobsen authored Sep 26, 2024
1 parent 0b193af commit b33f9de
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/kotlin/no/item/xp/plugin/GenerateCodeTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ open class GenerateCodeTask

if (files.isNotEmpty()) {
val fileContent = renderGlobalContentTypeMap(files, appName)
val targetFile = File(rootOutputDir.absolutePath + "/site/content-types/index.d.ts")
val targetFile = File(concatFileName(rootOutputDir.absolutePath, "site", "content-types", "index.d.ts"))
writeTargetFile(targetFile, fileContent, prependText, singleQuote)
logger.lifecycle("Updated file: ${Path.of(targetFile.toURI()).toUri()}")
}
Expand All @@ -175,7 +175,8 @@ open class GenerateCodeTask

val filesInJar =
xmlFilesInJars
.filter { it.entry.name.contains(concatFileName("site", componentTypeName)) }
// ZipEntry.name has UNIX style path. See 4.4.17.1 of the zip file spec.
.filter { it.entry.name.contains("site/$componentTypeName") }
.map { File(it.entry.name).nameWithoutExtension }

val files = (xmlFiles + filesInJar).sorted().distinct()
Expand Down Expand Up @@ -207,7 +208,7 @@ open class GenerateCodeTask

if (files.isNotEmpty()) {
val fileContent = renderGlobalXDataMap(files, appName)
val targetFile = File(rootOutputDir.absolutePath + "/site/x-data/index.d.ts")
val targetFile = File(concatFileName(rootOutputDir.absolutePath, "site", "x-data", "index.d.ts"))
writeTargetFile(targetFile, fileContent, prependText, singleQuote)
logger.lifecycle("Updated file: ${Path.of(targetFile.toURI()).toUri()}")
}
Expand Down

0 comments on commit b33f9de

Please sign in to comment.