4 ms·
Our desktop product built using Electron and .NET runs cross platform. Originally it was on Windows only and I personally did the work required to make it work
by jonathanlydall 2y ago
Our desktop product built using Electron and .NET runs cross platform.
Originally it was on Windows only and I personally did the work required to make it work cross platform once .NET Core became mature enough, so I’m very familiar with the path separator challenges.
It was a bit of a pain, but not a huge deal. The trick was to just use forward slashes all the time, except for display or storing an absolute path.
Windows doesn’t seem to care when you use forward slashes for everything even if looks wrong.
Admittedly the Node code dealing with paths is limited as most of the heavy work in our app is done in a .NET background agent, but there are things like file selection dialogues and config loading that is in the Node part.
Based on the fact I can’t remember exactly what I did for paths in Node leads me to believe it was pretty much a non-issue, I probably used forward slashes and it just worked.
It took a lot more work for the .NET aspect where we’re doing a lot more stuff on the file system, I had to find and replace most path usages with a utility function to convert the separators appropriately.