LibreTube/app/src/main/java/com/github/libretube/extensions/Path.kt

15 lines
303 B
Kotlin
Raw Normal View History

package com.github.libretube.extensions
import android.net.Uri
import androidx.core.net.toUri
import java.nio.file.Path
import kotlin.io.path.exists
2023-03-17 05:47:45 +05:30
fun Path.toAndroidUriOrNull(): Uri? {
return if (exists()) toAndroidUri() else null
}
fun Path.toAndroidUri(): Uri {
return toFile().toUri()
}