示例#1
0
文件: Common.cs 项目: dfev77/LongPath
        internal static bool Exists(string path, out bool isDirectory)
        {
            string normalizedPath = path;

            if (Path.TryNormalizeLongPath(path, out normalizedPath) || IsPathUnc(path))
            {
                FileAttributes attributes;
                int            errorCode = TryGetFileAttributes(normalizedPath, out attributes);
                if (errorCode == 0 && (int)attributes != NativeMethods.INVALID_FILE_ATTRIBUTES)
                {
                    isDirectory = Directory.IsDirectory(attributes);
                    return(true);
                }
            }

            isDirectory = false;
            return(false);
        }