Yokan / rebuild
Course 1 8624561

LocalFileService.android.kt

composeApp/src/androidMain/kotlin/eu/friedcutlet/yokan/services/files/LocalFileService.android.kt

implementation23 lines
1package eu.friedcutlet.yokan.services.files23import eu.friedcutlet.yokan.AndroidAppContext45actual fun createPlatformLocalArchiveService(profileId: eu.friedcutlet.yokan.domain.ProfileId): LocalArchiveService = AndroidSafLocalArchiveService(6    cacheRoot = createPlatformLocalFileService(profileId).cacheRoot,7)89actual fun createPlatformLocalFileService(profileId: eu.friedcutlet.yokan.domain.ProfileId): LocalFileService {10    val context = AndroidAppContext.appContext11    val namespace = eu.friedcutlet.yokan.domain.ProfileStorageNamespace(profileId)12    if (profileId != eu.friedcutlet.yokan.domain.ProfileId.Default) checkNotNull(context) { "Android context unavailable" }13    val filesDir = context?.filesDir?.absolutePath ?: System.getProperty("java.io.tmpdir").orEmpty()14    return AndroidSafLocalFileService(15        JvmLocalFileService(16            downloadRoot = "${namespace.ownedRoot(filesDir)}/downloads",17            backupRoot = "${namespace.ownedRoot(filesDir)}/backups",18            cacheRoot = if (namespace.relativeRoot == null) context?.cacheDir?.absolutePath ?: "$filesDir/cache"19                else "${namespace.ownedRoot(checkNotNull(context).cacheDir.absolutePath)}/cache",20            openDirectory = ::openAndroidDirectory,21        ),22    )23}24

Search chapters, reference and source filenames.