Skip to content

Commit

Permalink
Change: defaultName -> defaultPath
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Dec 31, 2024
1 parent 155f9ca commit 6708d8d
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/backend/browser/fileImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@ export const readFileImpl = async (filePath: string) => {
// 返り値はファイルパスではなく、疑似パスを返す
export const showExportFilePickerImpl: (typeof window)[typeof SandboxKey]["showExportFileDialog"] =
async (obj: {
defaultName?: string;
defaultPath?: string;
extensionName: string;
extensions: string[];
title: string;
}) => {
const handle = await showSaveFilePicker({
suggestedName: obj.defaultName,
suggestedName: obj.defaultPath,
types: [
{
description: obj.extensions.join("、"),
Expand Down
2 changes: 1 addition & 1 deletion src/backend/browser/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const api: Sandbox = {
return fileHandle?.[0];
},
async showExportFileDialog(obj: {
defaultName?: string;
defaultPath?: string;
extensionName: string;
extensions: string[];
title: string;
Expand Down
4 changes: 2 additions & 2 deletions src/backend/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,12 @@ registerIpcMainHandle<IpcMainHandle>({

SHOW_EXPORT_FILE_DIALOG: async (
_,
{ title, defaultName, extensionName, extensions },
{ title, defaultPath, extensionName, extensions },
) => {
const result = await retryShowSaveDialogWhileSafeDir(() =>
dialog.showSaveDialog(win, {
title,
defaultPath: defaultName,
defaultPath,
filters: [{ name: extensionName, extensions: extensions }],
properties: ["createDirectory"],
}),
Expand Down
4 changes: 2 additions & 2 deletions src/backend/electron/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ const api: Sandbox = {
});
},

showExportFileDialog: ({ title, defaultName, extensionName, extensions }) => {
showExportFileDialog: ({ title, defaultPath, extensionName, extensions }) => {
return ipcRendererInvokeProxy.SHOW_EXPORT_FILE_DIALOG({
title,
defaultName,
defaultPath,
extensionName,
extensions,
});
Expand Down
6 changes: 3 additions & 3 deletions src/store/audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
} else {
filePath ??= await window.backend.showExportFileDialog({
title: "音声を保存",
defaultName: defaultAudioFileName,
defaultPath: defaultAudioFileName,
extensionName: "WAV ファイル",
extensions: ["wav"],
});
Expand Down Expand Up @@ -1521,7 +1521,7 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
} else {
filePath ??= await window.backend.showExportFileDialog({
title: "音声を全て繋げて保存",
defaultName: defaultFileName,
defaultPath: defaultFileName,
extensionName: "WAV ファイル",
extensions: ["wav"],
});
Expand Down Expand Up @@ -1666,7 +1666,7 @@ export const audioStore = createPartialStore<AudioStoreTypes>({
} else {
filePath ??= await window.backend.showExportFileDialog({
title: "文章を全て繋げてテキストファイルに保存",
defaultName: defaultFileName,
defaultPath: defaultFileName,
extensionName: "テキストファイル",
extensions: ["txt"],
});
Expand Down
4 changes: 2 additions & 2 deletions src/store/singing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2770,7 +2770,7 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
} else {
filePath ??= await window.backend.showExportFileDialog({
title: "音声を保存",
defaultName: fileName,
defaultPath: fileName,
extensions: ["wav"],
extensionName: "WAV ファイル",
});
Expand Down Expand Up @@ -3532,7 +3532,7 @@ export const singingStore = createPartialStore<SingingStoreTypes>({

let filePath = await window.backend.showExportFileDialog({
title: "プロジェクトを書き出し",
defaultName: fileBaseName,
defaultPath: fileBaseName,
extensionName: fileTypeLabel,
extensions: [extension],
});
Expand Down
2 changes: 1 addition & 1 deletion src/type/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export type IpcIHData = {
args: [
obj: {
title: string;
defaultName?: string;
defaultPath?: string;
extensionName: string;
extensions: string[];
},
Expand Down
2 changes: 1 addition & 1 deletion src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export interface Sandbox {
}): Promise<string | undefined>;
showExportFileDialog(obj: {
title: string;
defaultName?: string;
defaultPath?: string;
extensionName: string;
extensions: string[];
}): Promise<string | undefined>;
Expand Down

0 comments on commit 6708d8d

Please sign in to comment.