Skip to content

Support picking and reading local music folders on the web #26

Closed

Description

@henry-wm

Problem

core.Scope.PickDirectories is not supported by the web backend. In internal/platform/web/web.go, driver.ItemPickDirectories currently returns driver.NoDirectoryPicker, so apps that rely on folder selection appear unresponsive in the browser. This prevents local music apps such as WoodWind from adding a music library when run with nsgo dev -target web.

Request

Please add web support for selecting a directory (for example, using window.showDirectoryPicker() with an <input type="file" webkitdirectory> fallback where appropriate) and expose the selected files through an API that works without native filesystem paths.

The existing roadmap already calls out folder picking on the web and the need for a directory abstraction that can open its contents. Supporting this would let apps browse local folders while respecting browser permission and security constraints.

Activity

  1. oneo-me commented on Nov 8, 2026

    @oneo-me
    Collaborator

    Done in 97feb42. PickDirectories now works on the web, and on iOS and Android too.

    A picked Directory is now an fs.FS (Open, ReadDir, Stat), so a music library can be scanned with fs.WalkDir(dir, ".", ...) without a native path:

    • Web: showDirectoryPicker where the browser has it (Chromium), reading entries and files on demand; elsewhere <input webkitdirectory>, which lists the folder whole (folders holding no files are left out). One folder per pick.
    • Android: ACTION_OPEN_DOCUMENT_TREE; the runtime lists the tree and reads its documents for the Go process. One folder per pick.
    • iOS: UIDocumentPickerViewController for folders, kept in its security scope while the app runs, read by Path.
    • Desktops: unchanged, read by Path.

    Opened files are io.Seekers on every target, so tag readers can jump to the end of a file. On Android and the web each read waits for the platform, so read folders off the engine's goroutine (in a goroutine, posting results back with Scope.Post), as the gallery's System demo does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions