Exemple #1
0
        //------------------------------------------------------------
        // IOUtil.IsPathRooted
        //
        /// <summary>
        /// <para>>Path.IsPathRooted determines
        /// that a relative path with a drive name is an absolute path.
        /// For example, it returns true for @"C:User\temp.txt". (CLS 2.0)</para>
        /// <para>This method</para>
        /// </summary>
        //------------------------------------------------------------
        static internal bool IsPathRooted(string path)
        {
            if (!Path.IsPathRooted(path))
            {
                return(false);
            }

            int i = 0;

            while (Char.IsWhiteSpace(path[i]))
            {
                ++i;
            }
            if (path.Length - i >= 3 &&
                CharUtil.IsAsciiAlphabet(path[i]) &&
                path[i + 1] == Path.VolumeSeparatorChar &&
                path[i + 2] != Path.DirectorySeparatorChar)
            {
                return(false);
            }
            return(true);
        }