package eu.friedcutlet.yokan.app.profiles import eu.friedcutlet.yokan.domain.ProfileId /** Call only under the coordinator's deletion lease, after all sessions/work for this ID retire. */ internal suspend fun deleteProfileStorage(id: ProfileId, exportedBackups: List = emptyList()) { require(id != ProfileId.Default) { "Default storage cannot be deleted" } val lease = acquireProfileStorageLease(id) try { deletePlatformProfileStorage(id, exportedBackups) } finally { kotlinx.coroutines.withContext(kotlinx.coroutines.NonCancellable) { lease.close() } } } /** Uses app-owned roots, never settings paths or external-folder grants. */ internal expect suspend fun deletePlatformProfileStorage(id: ProfileId, exportedBackups: List)