Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/desktop/electron-builder.config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ test("shared packaging defaults", async () => {
expect(config.mac?.sign).toBeFunction()
expect(config.dmg?.sign).not.toBe(true)
expect(config.mac?.extendInfo?.NSAutoFillRequiresTextContentTypeForOneTimeCodeOnMac).toBe(true)
// macOS shows the folder-access prompt only when the bundle carries a non-empty usage
// description; a missing or empty one is denied outright with no prompt at all.

for (const key of [
"NSDocumentsFolderUsageDescription",
"NSDesktopFolderUsageDescription",
"NSDownloadsFolderUsageDescription",
])
expect(config.mac?.extendInfo?.[key]).toMatch(/\S/)
const include = path.join(import.meta.dirname, "resources/windows/installer.nsh")
expect(config.nsis?.include).toBe(include)
expect(await Bun.file(include).exists()).toBe(true)
Expand Down
11 changes: 11 additions & 0 deletions packages/desktop/electron-builder.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,17 @@ const getBase = (appId: string): Configuration => {
icon: `resources/icons/icon.icns`,
extendInfo: {
NSAutoFillRequiresTextContentTypeForOneTimeCodeOnMac: true,
// A workspace can be any folder the user picks, and macOS gates Documents,
// Desktop and Downloads behind TCC. Without the matching usage description
// the system denies access without prompting, the app never appears under
// Privacy & Security → Files and Folders, and every location-scoped request
// fails with EPERM. The description is what turns the denial into a prompt.
NSDocumentsFolderUsageDescription:
"OpenCode needs access to the folders you open as workspaces, including folders inside your Documents folder.",
NSDesktopFolderUsageDescription:
"OpenCode needs access to the folders you open as workspaces, including folders inside your Desktop folder.",
NSDownloadsFolderUsageDescription:
"OpenCode needs access to the folders you open as workspaces, including folders inside your Downloads folder.",
},
hardenedRuntime: true,
gatekeeperAssess: false,
Expand Down
Loading