This caused some mildly hard-to-track issues when “porting” some Linux-developed code to Windows. I realise that some system differences are hard to avoid, but this one seems a bit arbritrary.
Thanks for the link! I missed that issue (for some reason it doesn’t come up on a search for tempdir).
I had some very old test code where I wanted a temporary file with a specific name, something like outfile = "$(tempdir())/specifictest"
which works on Linux but not on Windows, which gets confused by the /.
The \ problem can be avoided by using joinpath/splitpath whenever paths are employed. It still requires specific handling whenever reading valid paths generated outside julia.
I am not sure why it would matter. You cannot consistently rely on the presence of trailing /s in most contexts, and as others have pointed out, should always use the relevant API for working with paths, instead of treating them as strings.
Incidentally, perhaps it would be useful to experiment with a specific type for paths (in a package), possibly wrapping a string but in an opaque way. Beside trivial puns (eg * could be joinpath, abs would make absolute paths), it would enforce the API more idiomatically.