Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Remove unused IPC method

Manav Rathi18ac36168848
diff --git a/desktop/src/main/fs.ts b/desktop/src/main/fs.ts
index 8d92820341..11ab360495 100644
--- a/desktop/src/main/fs.ts
+++ b/desktop/src/main/fs.ts
@@ -3,7 +3,6 @@
*/
import { createWriteStream, existsSync } from "node:fs";
import fs from "node:fs/promises";
-import path from "node:path";
import { Readable } from "node:stream";
export const fsExists = (path: string) => existsSync(path);
@@ -91,16 +90,6 @@ export const saveFileToDisk = (path: string, contents: string) =>
export const readTextFile = async (filePath: string) =>
fs.readFile(filePath, "utf-8");
-export const moveFile = async (sourcePath: string, destinationPath: string) => {
- if (existsSync(destinationPath)) {
- throw new Error("Destination file already exists");
- }
- // check if destination folder exists
- const destinationFolder = path.dirname(destinationPath);
- await fs.mkdir(destinationFolder, { recursive: true });
- await fs.rename(sourcePath, destinationPath);
-};
-
export const isFolder = async (dirPath: string) => {
if (!existsSync(dirPath)) return false;
const stats = await fs.stat(dirPath);
diff --git a/desktop/src/main/ipc.ts b/desktop/src/main/ipc.ts
index 12bcc72bf4..36e13ec60b 100644
--- a/desktop/src/main/ipc.ts
+++ b/desktop/src/main/ipc.ts
@@ -18,13 +18,12 @@ import {
showUploadZipDialog,
} from "./dialogs";
import {
- fsRm,
- fsRmdir,
fsExists,
fsMkdirIfNeeded,
fsRename,
+ fsRm,
+ fsRmdir,
isFolder,
- moveFile,
readTextFile,
saveFileToDisk,
saveStreamToDisk,
@@ -195,10 +194,6 @@ export const attachIPCHandlers = () => {
ipcMain.handle("isFolder", (_, dirPath: string) => isFolder(dirPath));
- ipcMain.handle("moveFile", (_, oldPath: string, newPath: string) =>
- moveFile(oldPath, newPath),
- );
-
// - Upload
ipcMain.handle("getPendingUploads", () => getPendingUploads());
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index d33e2b6751..1a344e832a 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -105,6 +105,11 @@ const fsMkdirIfNeeded = (dirPath: string): Promise<void> =>
const fsRename = (oldPath: string, newPath: string): Promise<void> =>
ipcRenderer.invoke("fsRename", oldPath, newPath);
+const fsRmdir = (path: string): Promise<void> =>
+ ipcRenderer.invoke("fsRmdir", path);
+
+const fsRm = (path: string): Promise<void> => ipcRenderer.invoke("fsRm", path);
+
// - AUDIT below this
// - Conversion
@@ -238,14 +243,6 @@ const readTextFile = (path: string): Promise<string> =>
const isFolder = (dirPath: string): Promise<boolean> =>
ipcRenderer.invoke("isFolder", dirPath);
-const moveFile = (oldPath: string, newPath: string): Promise<void> =>
- ipcRenderer.invoke("moveFile", oldPath, newPath);
-
-const fsRmdir = (path: string): Promise<void> =>
- ipcRenderer.invoke("fsRmdir", path);
-
-const fsRm = (path: string): Promise<void> => ipcRenderer.invoke("fsRm", path);
-
// - Upload
const getPendingUploads = (): Promise<{
@@ -359,7 +356,6 @@ contextBridge.exposeInMainWorld("electron", {
saveFileToDisk,
readTextFile,
isFolder,
- moveFile,
// - Upload
diff --git a/web/packages/next/types/ipc.ts b/web/packages/next/types/ipc.ts
index 301a951917..69b0c3593c 100644
--- a/web/packages/next/types/ipc.ts
+++ b/web/packages/next/types/ipc.ts
@@ -307,7 +307,6 @@ export interface Electron {
saveFileToDisk: (path: string, contents: string) => Promise<void>;
readTextFile: (path: string) => Promise<string>;
isFolder: (dirPath: string) => Promise<boolean>;
- moveFile: (oldPath: string, newPath: string) => Promise<void>;
// - Upload