I'm building a .Net Core 2.0 console application that will run on both Windows and Ubuntu systems. I have a string that needs to be converted into a safe file name. Currently I'm using the following code to achieve this:
var safeName = string.Join("-", name.Split(Path.GetInvalidFileNameChars()));
It works, but it will produce different results on different operating system as Linux allows characters that Windows will not allow. I like a solution that produces the same result on all of the systems.
Is there a cross platform version of GetInvalidFileNameChars that will return characters for all platforms?