This commit is contained in:
michalcourson
2026-03-03 17:47:45 -05:00
parent 017a2ae5a4
commit d3d5270889
7 changed files with 60 additions and 29 deletions

View File

@@ -10,12 +10,20 @@
*/
import fs from 'fs';
import path from 'path';
import { app, BrowserWindow, shell, ipcMain, Tray, Menu } from 'electron';
import {
app,
BrowserWindow,
shell,
ipcMain,
Tray,
Menu,
dialog,
} from 'electron';
import { autoUpdater } from 'electron-updater';
import log from 'electron-log';
import MenuBuilder from './menu';
import { resolveHtmlPath } from './util';
import registerFileIpcHandlers from '../ipc/audio/main';
import registerFileIpcHandlers from '../ipc/main';
import PythonSubprocessManager from './service';
const pythonManager = new PythonSubprocessManager('src/main.py');
@@ -110,6 +118,21 @@ const createWindow = async () => {
menuBuilder.buildMenu();
registerFileIpcHandlers();
ipcMain.handle('select-directory', async () => {
try {
const result = await dialog.showOpenDialog(mainWindow, {
properties: ['openDirectory'], // Key property to select a folder
});
if (!result.canceled && result.filePaths.length > 0) {
// Send the selected directory path back to the renderer process
return result.filePaths[0];
}
return null;
} catch (err: any) {
return { error: err.message };
}
});
// Open urls in the user's browser
mainWindow.webContents.setWindowOpenHandler((edata) => {
shell.openExternal(edata.url);
@@ -164,7 +187,7 @@ app
.whenReady()
.then(() => {
// if (app.isPackaged) {
// pythonManager.start();
pythonManager.start();
// }
createWindow();
app.on('activate', () => {