internal static int TryGetDirectoryAttributes(string normalizedPath, out FileAttributes attributes)
        {
            var errorCode = TryGetFileAttributes(normalizedPath, out attributes);

            if (!LongPathDirectory.IsDirectory(attributes))
            {
                errorCode = NativeMethods.ERROR_DIRECTORY;
            }

            return(errorCode);
        }
        internal static bool Exists(string path, out bool isDirectory)
        {
            string normalizedPath;

            if (TryNormalizeLongPath(path, out normalizedPath))
            {
                FileAttributes attributes;
                var            errorCode = TryGetFileAttributes(normalizedPath, out attributes);
                if (errorCode == 0)
                {
                    isDirectory = LongPathDirectory.IsDirectory(attributes);
                    return(true);
                }
            }

            isDirectory = false;
            return(false);
        }