diff options
Diffstat (limited to 'core/src/main/kotlin/Locations/FoldersLocationService.kt')
-rw-r--r-- | core/src/main/kotlin/Locations/FoldersLocationService.kt | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/src/main/kotlin/Locations/FoldersLocationService.kt b/core/src/main/kotlin/Locations/FoldersLocationService.kt index 83e1cf6ac..a2af03b1b 100644 --- a/core/src/main/kotlin/Locations/FoldersLocationService.kt +++ b/core/src/main/kotlin/Locations/FoldersLocationService.kt @@ -14,17 +14,18 @@ class FoldersLocationService @Inject constructor(@Named("outputDir") val rootFil return if (extension.isEmpty()) FoldersLocationService(rootFile, newExtension) else this } - override fun location(qualifiedName: List<String>, hasMembers: Boolean): FileLocation { - return FileLocation(File(rootFile, relativePathToNode(qualifiedName, hasMembers)).appendExtension(extension)) + override fun location(qualifiedName: List<String>, hasMembers: Boolean, fileName: String): FileLocation { + return FileLocation(File(rootFile, relativePathToNode(qualifiedName, hasMembers, fileName)) + .appendExtension(extension)) } } -fun relativePathToNode(qualifiedName: List<String>, hasMembers: Boolean): String { +fun relativePathToNode(qualifiedName: List<String>, hasMembers: Boolean, fileName: String): String { val parts = qualifiedName.map { identifierToFilename(it) }.filterNot { it.isEmpty() } return if (!hasMembers) { // leaf node, use file in owner's folder parts.joinToString("/") } else { - parts.joinToString("/") + (if (parts.none()) "" else "/") + "index" + parts.joinToString("/") + (if (parts.none()) "" else "/") + fileName } } |