Пример #1
0
        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);
        }