Skip to content

armgit / ente

Public Imported from GitHub
0

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

Research

Manav Rathicb73bc143dde
diff --git a/desktop/src/main/utils/electron.ts b/desktop/src/main/utils/electron.ts
index d627ec5c46..43471cd1ee 100644
--- a/desktop/src/main/utils/electron.ts
+++ b/desktop/src/main/utils/electron.ts
@@ -11,6 +11,19 @@ export const isDev = !app.isPackaged;
/**
* Convert a file system {@link filePath} that uses the local system specific
* path separators into a path that uses POSIX file separators.
+ *
+ * For all paths that we persist or pass over the IPC boundary, we always use
+ * POSIX paths, even on Windows.
+ *
+ * Windows recognizes both forward and backslashes. This also works with drive
+ * names. c:\foo\bar and c:/foo/bar are both valid.
+ *
+ * > Almost all paths passed to Windows APIs are normalized. During
+ * > normalization, Windows performs the following steps: ... All forward
+ * > slashes (/) are converted into the standard Windows separator, the back
+ * > slash (\).
+ * >
+ * > https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats
*/
export const posixPath = (filePath: string) =>
filePath.split(path.sep).join(path.posix.sep);