diff --git a/src/main/index.ts b/src/main/index.ts index 8e109e0d3..7bb8487d4 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -3320,7 +3320,7 @@ async function bootstrap(): Promise { const result = await dialog.showOpenDialog(mainWindow, { title: harnessLocale() === 'zh' ? '选择工作区目录' : 'Select Workspace Directory', - properties: ['openDirectory'] + properties: ['openDirectory', 'createDirectory'] }) return result.canceled ? null : result.filePaths[0] ?? null }) diff --git a/test/directory-picker.test.ts b/test/directory-picker.test.ts index e024611c8..f37aaa89a 100644 --- a/test/directory-picker.test.ts +++ b/test/directory-picker.test.ts @@ -54,4 +54,12 @@ describe('desktop Electron directory picker', () => { expect(controller).toContain('static inject = ["directoryPicker"]') expect(controller).toContain('"directoryPickerController"') }) + + it('lets the workspace directory dialog create a folder on macOS', async () => { + const main = await readFile('src/main/index.ts', 'utf8') + const handlerStart = main.indexOf("ipcMain.handle('directory-picker:open'") + const handler = main.slice(handlerStart, main.indexOf('ipcMain.handle(', handlerStart + 1)) + + expect(handler).toContain("properties: ['openDirectory', 'createDirectory']") + }) }) diff --git a/test/signed-test-build.test.ts b/test/signed-test-build.test.ts index 6578e2395..654f894f6 100644 --- a/test/signed-test-build.test.ts +++ b/test/signed-test-build.test.ts @@ -58,7 +58,7 @@ with tempfile.TemporaryDirectory() as work: assert [e[0] for e in events] == ['upload', 'verify', 'notify'] assert events[0][1] == 'test/1.0.0-test.1/42/dsh-desktop-windows-x64-setup.exe' assert events[2][1] == {'test_build': True} - assert 'Windows x64' in (directory / 'summary').read_text() + assert 'Windows x64' in (directory / 'summary').read_text(encoding='utf-8') notify.reset_mock() api.upload_file.side_effect = RuntimeError('upload failed') try: