in dsl/ktor/ktor-lang-parser/src/main/kotlin/io/kotless/parser/ktor/processor/route/StaticRoutesProcessor.kt [33:66]
override fun process(files: Set<KtFile>, binding: BindingContext, context: ProcessorContext) {
processClassesOrObjects(files, binding) { klass, _ ->
klass.visitNamedFunctions(filter = { func -> func.name == KotlessAzure::prepare.name }) { func ->
func.visitCallExpressionsWithReferences(filter = { it.getFqName(binding) in functions }, binding = binding) { element ->
val outer = getStaticPath(element, binding)
val base = getStaticRootFolder(element, binding, context)
when (element.getFqName(binding)) {
"io.ktor.http.content.file" -> {
val remotePath = element.getArgument("remotePath", binding).asString(binding)
val localPath = element.getArgumentOrNull("localPath", binding)?.asString(binding) ?: remotePath
val file = File(base, localPath)
val path = URIPath(outer, remotePath)
createResource(file, path, context)
}
"io.ktor.http.content.default" -> {
val localPath = element.getArgument("localPath", binding).asString(binding)
val file = File(base, localPath)
createResource(file, outer, context)
}
"io.ktor.http.content.files" -> {
val folder = File(base, element.getArgument("folder", binding).asString(binding))
addStaticFolder(folder, outer, context)
}
}
}
}
}
}