mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-08 10:30:30 +05:30
15 lines
303 B
Kotlin
15 lines
303 B
Kotlin
package com.github.libretube.extensions
|
|
|
|
import android.net.Uri
|
|
import androidx.core.net.toUri
|
|
import java.nio.file.Path
|
|
import kotlin.io.path.exists
|
|
|
|
fun Path.toAndroidUriOrNull(): Uri? {
|
|
return if (exists()) toAndroidUri() else null
|
|
}
|
|
|
|
fun Path.toAndroidUri(): Uri {
|
|
return toFile().toUri()
|
|
}
|