aboutsummaryrefslogtreecommitdiff
path: root/src/Locations/SingleFolderLocationService.kt
blob: 049636c0ceae6ff1ec4bcf466feaa2669884646a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package org.jetbrains.dokka

import com.google.inject.Inject
import com.google.inject.name.Named
import java.io.File

public fun SingleFolderLocationService(root: String): SingleFolderLocationService = SingleFolderLocationService(File(root), "")
public class SingleFolderLocationService @Inject constructor(@Named("outputDir") val root: File, val extension: String) : FileLocationService {
    override fun withExtension(newExtension: String): FileLocationService =
        SingleFolderLocationService(root, newExtension)

    override fun location(qualifiedName: List<String>, hasMembers: Boolean): FileLocation {
        val filename = qualifiedName.map { identifierToFilename(it) }.joinToString("-")
        return FileLocation(File(root, filename).appendExtension(extension))
    }
}