System.IO.Path.IsPathRooted(ReadOnlySpan)

Here are the examples of the csharp api System.IO.Path.IsPathRooted(ReadOnlySpan) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

19 Source : Path.Unix.cs
with MIT License
from Team-RTCLI

public static string GetFullPath(string path)
        {
            if (path == null)
                throw new ArgumentNullException(nameof(path));

            if (path.Length == 0)
                throw new ArgumentException(SR.Arg_PathEmpty, nameof(path));

            if (path.Contains('\0'))
                throw new ArgumentException(SR.Argument_InvalidPathChars, nameof(path));

            // Expand with current directory if necessary
            if (!IsPathRooted(path))
            {
                path = Combine(Interop.Sys.GetCwd(), path);
            }

            // We would ideally use realpath to do this, but it resolves symlinks, requires that the file actually exist,
            // and turns it into a full path, which we only want if fullCheck is true.
            string collapsedString = PathInternal.RemoveRelativeSegments(path, PathInternal.GetRootLength(path));

            Debug.replacedert(collapsedString.Length < path.Length || collapsedString.ToString() == path,
                "Either we've removed characters, or the string should be unmodified from the input path.");

            string result = collapsedString.Length == 0 ? PathInternal.DirectorySeparatorCharreplacedtring : collapsedString;

            return result;
        }

19 Source : Path.Unix.cs
with MIT License
from Team-RTCLI

public static bool IsPathRooted([NotNullWhen(true)] string? path)
        {
            if (path == null)
                return false;

            return IsPathRooted(path.replacedpan());
        }

19 Source : Path.Unix.cs
with MIT License
from Team-RTCLI

public static ReadOnlySpan<char> GetPathRoot(ReadOnlySpan<char> path)
        {
            return IsPathRooted(path) ? PathInternal.DirectorySeparatorCharreplacedtring.replacedpan() : ReadOnlySpan<char>.Empty;
        }

19 Source : Path.Windows.cs
with MIT License
from Team-RTCLI

public static bool IsPathRooted([NotNullWhen(true)] string? path)
        {
            return path != null && IsPathRooted(path.replacedpan());
        }