Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -59,6 +59,24 @@ ipcMain.handle("project:load", async () => {
|
||||
return { canceled: false, filePath, data };
|
||||
});
|
||||
|
||||
ipcMain.handle("audio:pickFile", async () => {
|
||||
const result = await dialog.showOpenDialog({
|
||||
properties: ["openFile"],
|
||||
filters: [
|
||||
{ name: "Audio", extensions: ["mp3", "m4a", "flac", "wma"] }
|
||||
]
|
||||
});
|
||||
|
||||
if (result.canceled || result.filePaths.length === 0) {
|
||||
return { canceled: true };
|
||||
}
|
||||
|
||||
return {
|
||||
canceled: false,
|
||||
filePath: result.filePaths[0]
|
||||
};
|
||||
});
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user