Skip to content

Commit

Permalink
Electron16かつLinuxだとshowOpenDialogSync、showSaveDialogSyncが動作しないので非同期版に…
Browse files Browse the repository at this point in the history
…置き換え (#512)

* add detectNvidia function

* follow to menu bar

* remove no longer a variable

* run fmt

* fix typo

* remove utils.ts and some changes in background.ts

* change message box type and detail, and change behaviour of setOnLaunchModeItemClicked

* recreate package-lock.json using node 12.18.2

* re recreate package-lock.json using node 12.18.2 and npm 7.20.5

* recreate package-lock.json using node 12.18.2 and npm 6.14.5

* recreate package-lock.json using node 12.18.2 and npm 7.20.3

* fix conflict

* fix

* Revert "fix"

This reverts commit 99b1def.

* fix
  • Loading branch information
madosuki committed Nov 26, 2021
1 parent 6b96323 commit 6445201
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/background.ts
Expand Up @@ -455,36 +455,49 @@ ipcMainHandle("GET_OSS_COMMUNITY_INFOS", () => {
return ossCommunityInfos;
});

ipcMainHandle("SHOW_AUDIO_SAVE_DIALOG", (_, { title, defaultPath }) => {
return dialog.showSaveDialogSync(win, {
ipcMainHandle("SHOW_AUDIO_SAVE_DIALOG", async (_, { title, defaultPath }) => {
const result = await dialog.showSaveDialog(win, {
title,
defaultPath,
filters: [{ name: "Wave File", extensions: ["wav"] }],
properties: ["createDirectory"],
});
return result.filePath;
});

ipcMainHandle("SHOW_OPEN_DIRECTORY_DIALOG", (_, { title }) => {
return dialog.showOpenDialogSync(win, {
ipcMainHandle("SHOW_OPEN_DIRECTORY_DIALOG", async (_, { title }) => {
const result = await dialog.showOpenDialog(win, {
title,
properties: ["openDirectory", "createDirectory"],
})?.[0];
});
if (result.canceled) {
return undefined;
}
return result.filePaths[0];
});

ipcMainHandle("SHOW_PROJECT_SAVE_DIALOG", (_, { title }) => {
return dialog.showSaveDialogSync(win, {
ipcMainHandle("SHOW_PROJECT_SAVE_DIALOG", async (_, { title }) => {
const result = await dialog.showSaveDialog(win, {
title,
filters: [{ name: "VOICEVOX Project file", extensions: ["vvproj"] }],
properties: ["showOverwriteConfirmation"],
});
if (result.canceled) {
return undefined;
}
return result.filePath;
});

ipcMainHandle("SHOW_PROJECT_LOAD_DIALOG", (_, { title }) => {
return dialog.showOpenDialogSync(win, {
ipcMainHandle("SHOW_PROJECT_LOAD_DIALOG", async (_, { title }) => {
const result = await dialog.showOpenDialog(win, {
title,
filters: [{ name: "VOICEVOX Project file", extensions: ["vvproj"] }],
properties: ["openFile"],
});
if (result.canceled) {
return undefined;
}
return result.filePaths;
});

ipcMainHandle("SHOW_INFO_DIALOG", (_, { title, message, buttons }) => {
Expand Down

0 comments on commit 6445201

Please sign in to comment.