Mac/PC differences in directory symbols '\' and '/'

Hi,

Some C# code from a PC project was broken on a Mac because of the directory path formatting as;

Assets\myFolder\myThing

Changing it to the following fixes it for the Mac

 Assets/myFolder/myThing

What’s the best way to handle this situation to ensure the code runs cross-platform?

Actually On Mac and Windows the path separator is "" and for Linux it is “/”.

One way to overcome this issues is to use Path.DirectorySeparatorChar for avoiding such issues.

Wrap the delimiter symbol in a property, and use the #if conditional to make it return '' on windows platforms (the only platform to use \ as a delimiter). Something like this:

public static string delim {
    get {
        string delimString = "/";
#if (UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN)
        delimString = "\\";
#endif 
        return delimString;
    }
}

Note that '' must be escaped by another ''.