mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-09 19:10:30 +05:30
12 lines
293 B
Kotlin
12 lines
293 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.toAndroidUri(): Uri? {
|
||
|
@Suppress("NewApi") // The Path class is desugared.
|
||
|
return if (exists()) toFile().toUri() else null
|
||
|
}
|