Skip to content

armgit / ente

Public Imported from GitHub
0

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

Rearrange

Manav Rathiff787fde996a
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index 2db5da142b..ea7cc4df10 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -98,6 +98,14 @@ const openLogDirectory = () => ipcRenderer.invoke("openLogDirectory");
const selectDirectory = () => ipcRenderer.invoke("selectDirectory");
+// The path that we get back from `webUtils.getPathForFile` on Windows uses "\"
+// as the path separator. Convert them to POSIX separators.
+
+const pathForFile =
+ process.platform == "win32"
+ ? (file: File) => webUtils.getPathForFile(file).replace(/\\/g, "/")
+ : (file: File) => webUtils.getPathForFile(file);
+
const logout = () => {
watchRemoveListeners();
return ipcRenderer.invoke("logout");
@@ -263,14 +271,6 @@ const watchRemoveListeners = () => {
// - Upload
-// The path that we get back from `webUtils.getPathForFile` on Windows uses "\"
-// as the path separator. Convert them to POSIX separators.
-
-const pathForFile =
- process.platform == "win32"
- ? (file: File) => webUtils.getPathForFile(file).replace(/\\/g, "/")
- : (file: File) => webUtils.getPathForFile(file);
-
const listZipItems = (zipPath: string) =>
ipcRenderer.invoke("listZipItems", zipPath);
@@ -341,6 +341,7 @@ contextBridge.exposeInMainWorld("electron", {
openDirectory,
openLogDirectory,
selectDirectory,
+ pathForFile,
logout,
masterKeyB64,
saveMasterKeyB64,
@@ -395,7 +396,6 @@ contextBridge.exposeInMainWorld("electron", {
// - Upload
- pathForFile,
listZipItems,
pathOrZipItemSize,
pendingUploads,
diff --git a/web/packages/base/types/ipc.ts b/web/packages/base/types/ipc.ts
index 95f38f094f..31888169e5 100644
--- a/web/packages/base/types/ipc.ts
+++ b/web/packages/base/types/ipc.ts
@@ -63,6 +63,20 @@ export interface Electron {
*/
selectDirectory: () => Promise<string | undefined>;
+ /**
+ * Return the file system path that this File object points to.
+ *
+ * The returned path will use POSIX separators (even on Windows).
+ *
+ * This method is a bit different from the other methods on the Electron
+ * object in the sense that there is no actual IPC happening - the
+ * implementation of this method is completely in the preload script. Thus
+ * we can pass it an otherwise unserializable File object.
+ *
+ * Consequently, it is also _not_ async.
+ */
+ pathForFile: (file: File) => string;
+
/**
* Perform any logout related cleanup of native side state.
*/
@@ -463,18 +477,6 @@ export interface Electron {
// - Upload
- /**
- * Return the file system path that this File object points to.
- *
- * This method is a bit different from the other methods on the Electron
- * object in the sense that there is no actual IPC happening - the
- * implementation of this method is completely in the preload script. Thus
- * we can pass it an otherwise unserializable File object.
- *
- * Consequently, it is also _not_ async.
- */
- pathForFile: (file: File) => string;
-
/**
* Get the list of files that are present in the given zip file.
*