SCLoaderShared/Helpers/PathHelpers.cs
/// <summary>
/// Fixes mixed usage of path separator to the platform-specific form
/// </summary>
/// <param name="path"></param>
/// <param name="trailingSlash"></param>
/// <returns></returns>
Fixes mixed usage of path separator to the platform-specific form
Fixes mixed usage of path separator to the platform - specific form
public static string FixPathSeparators(string path, bool trailingSlash)
        {
            path = path.Trim();
            if (path.Length > 0)
            {
                path = path.Replace('\\', Path.DirectorySeparatorChar);
                path = path.Replace('/', Path.DirectorySeparatorChar);
                path = path.TrimEnd(Path.DirectorySeparatorChar);
                if (trailingSlash)
                {
                    path += Path.DirectorySeparatorChar;
                }
            }
            return path;
        }
public static string FixPathSeparators ( string path , bool trailingSlash ) { path = path . Trim ( ) ; if ( path . Length > 0 ) { path = path . Replace ( ' \\ ' , Path . DirectorySeparatorChar ) ; path = path . Replace ( ' ' , Path . DirectorySeparatorChar ) ; path = path . TrimEnd ( Path . DirectorySeparatorChar ) ; if ( trailingSlash ) { path += Path . DirectorySeparatorChar ; } } return path ; }
Fixes mixed usage of path separator to the platform-specific form
Fixes mixed usage of path separator to the platform - specific form
None
path
string
None
trailingSlash
bool
None