Konstantin Tskhovrebov
2 months ago
8 changed files with 94 additions and 19 deletions
@ -0,0 +1,19 @@
|
||||
package org.jetbrains.compose.resources |
||||
|
||||
internal data class WindowLocation(val origin: String, val pathname: String) |
||||
internal expect fun getWindowLocation(): WindowLocation |
||||
|
||||
@OptIn(ExperimentalResourceApi::class) |
||||
@InternalResourceApi |
||||
actual suspend fun convertPathToUri(path: String): String { |
||||
val resPath = WebResourcesConfiguration.getResourcePath(path) |
||||
return getWindowLocation().let { |
||||
if (resPath.startsWith("/")) { |
||||
it.origin + resPath |
||||
} else if (resPath.startsWith("http://") || resPath.startsWith("https://")) { |
||||
resPath |
||||
} else { |
||||
it.origin + it.pathname + resPath |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue