Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,6 @@ async function uninstallVvppEngine(engineId: EngineId) {
}
}

// temp dir
const tempDir = path.join(app.getPath("temp"), "VOICEVOX");
if (!fs.existsSync(tempDir)) {
fs.mkdirSync(tempDir);
}

// 使い方テキストの読み込み
const howToUseText = fs.readFileSync(
path.join(__static, "howtouse.md"),
Expand Down Expand Up @@ -563,10 +557,6 @@ ipcMainHandle("GET_APP_INFOS", () => {
};
});

ipcMainHandle("GET_TEMP_DIR", () => {
return tempDir;
});

ipcMainHandle("GET_HOW_TO_USE_TEXT", () => {
return howToUseText;
});
Expand Down Expand Up @@ -875,10 +865,6 @@ ipcMainHandle("WRITE_FILE", (_, { filePath, buffer }) => {
return undefined;
});

ipcMainHandle("JOIN_PATH", (_, { pathArray }) => {
return path.join(...pathArray);
});

ipcMainHandle("READ_FILE", (_, { filePath }) => {
return fs.promises.readFile(filePath);
});
Expand Down
28 changes: 0 additions & 28 deletions src/electron/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ function ipcRendererOn(
return ipcRenderer.on(channel, listener);
}

let tempDir: string;

const api: Sandbox = {
getAppInfos: async () => {
return await ipcRendererInvoke("GET_APP_INFOS");
Expand Down Expand Up @@ -75,32 +73,6 @@ const api: Sandbox = {
return await ipcRendererInvoke("GET_ALT_PORT_INFOS");
},

saveTempAudioFile: async ({ relativePath, buffer }) => {
if (!tempDir) {
tempDir = await ipcRendererInvoke("GET_TEMP_DIR");
}
const tempFilePath = await ipcRendererInvoke("JOIN_PATH", {
pathArray: [tempDir, relativePath],
});
await ipcRendererInvoke("WRITE_FILE", {
filePath: tempFilePath,
buffer: buffer,
});
},

loadTempFile: async () => {
if (!tempDir) {
tempDir = await ipcRendererInvoke("GET_TEMP_DIR");
}
const tempFilePath = await ipcRendererInvoke("JOIN_PATH", {
pathArray: [tempDir, "hoge.txt"],
});
const buf = await ipcRendererInvoke("READ_FILE", {
filePath: tempFilePath,
});
return new TextDecoder().decode(buf);
},

showAudioSaveDialog: ({ title, defaultPath }) => {
return ipcRendererInvoke("SHOW_AUDIO_SAVE_DIALOG", { title, defaultPath });
},
Expand Down
10 changes: 0 additions & 10 deletions src/type/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ export type IpcIHData = {
return: AppInfos;
};

GET_TEMP_DIR: {
args: [];
return: string;
};

GET_HOW_TO_USE_TEXT: {
args: [];
return: string;
Expand Down Expand Up @@ -297,11 +292,6 @@ export type IpcIHData = {
return: void;
};

JOIN_PATH: {
args: [obj: { pathArray: string[] }];
return: string;
};

WRITE_FILE: {
args: [obj: { filePath: string; buffer: ArrayBuffer }];
return: WriteFileErrorResult | undefined;
Expand Down
2 changes: 0 additions & 2 deletions src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ export interface Sandbox {
getContactText(): Promise<string>;
getPrivacyPolicyText(): Promise<string>;
getAltPortInfos(): Promise<AltPortInfos>;
saveTempAudioFile(obj: { relativePath: string; buffer: ArrayBuffer }): void;
loadTempFile(): Promise<string>;
showAudioSaveDialog(obj: {
title: string;
defaultPath?: string;
Expand Down