This commit is contained in:
Manav Rathi 2024-05-01 14:35:03 +05:30
parent 52909f6f21
commit cb73bc143d
No known key found for this signature in database

View file

@ -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);