SharedFolders

class SharedFolders(context: Context)(source)

Folders the user shares with the agent through the Storage Access Framework, mounted into FileSystem at /mnt/<name>:

val pick = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocumentTree()) { uri -> uri?.let(folders::add) }
val files = FileSystem(workspace, mounts = folders::mounts)

Access survives restarts (persisted URI permissions) until removed.

Constructors

Link copied to clipboard
constructor(context: Context)

Properties

Link copied to clipboard
val folders: StateFlow<List<SharedFolder>>

Functions

Link copied to clipboard
fun add(uri: Uri, writable: Boolean = true): SharedFolder

Keep access to the folder at uri (from OpenDocumentTree) and mount it; returns its mount.

Link copied to clipboard
fun mounts(): List<Mount>

The folders still accessible, as Mounts for FileSystem.

Link copied to clipboard
fun remove(name: String)

Unmount name and give up access to it.