hey :wave: it looks like in ktor 3, the `applicati...
# ktor
r
hey 👋 it looks like in ktor 3, the
application.environment.rootPath
value has been removed... is there a new way to identify the root path? asking b/c Kompendium needs this value in order to calculate the value of the root path for a route
Copy code
fun Route.calculateRoutePath() = toString()
    .let {
      application.environment.rootPath.takeIf { root -> root.isNotEmpty() } // <- invalid in 3.0
        ?.let { root ->
          val sanitizedRoute = if (root.startsWith("/")) root else "/$root"
          it.replace(sanitizedRoute, "")
        }
        ?: it
    }
    .replace(Regex("/\\(.+\\)"), "")
    .replace(Regex("/\\[.+\\]"), "")
a
You can access it from the
Application
object:
application.rootPath
✅ 1