hermes-agent/apps/desktop/electron/select-paths-dialog.ts
brooklyn! 771b42e2ef fix(desktop): let the project folder picker create a new folder
The native directory picker now passes createDirectory, so macOS shows
New Folder. The remote folder picker gets a New folder action that calls
the existing POST /api/files/mkdir under the current path and opens the
new folder, ready to select.
2026-09-24 02:27:45 -05:00

16 lines
673 B
TypeScript

import type { OpenDialogOptions } from 'electron'
type DialogProperty = NonNullable<OpenDialogOptions['properties']>[number]
// `hermes:selectPaths` → `dialog.showOpenDialog` properties. Directory pickers
// carry `createDirectory` so macOS shows New Folder: a new project needs a
// folder, and the picker is where the user expects to make one.
export function selectPathsDialogProperties(options: { directories?: boolean; multiple?: boolean } = {}) {
const properties: DialogProperty[] = options.directories ? ['openDirectory', 'createDirectory'] : ['openFile']
if (options.multiple !== false) {
properties.push('multiSelections')
}
return properties
}