/// <summary> /// Determines the type based on the attributes of the path /// </summary> /// <param name="fullPath">Full path</param> /// <returns><see cref="QuickIOFileSystemEntryType"/></returns> internal static QuickIOFileSystemEntryType DetermineFileSystemEntry(string fullPath) { Contract.Requires(!String.IsNullOrWhiteSpace(fullPath)); Win32FindData findData = InternalQuickIO.GetFindDataFromPath(fullPath); return(!InternalHelpers.ContainsFileAttribute(findData.dwFileAttributes, FileAttributes.Directory) ? QuickIOFileSystemEntryType.File : QuickIOFileSystemEntryType.Directory); }
public static bool FileExists(string path) { Contract.Requires(!String.IsNullOrWhiteSpace(path)); int win32Error; var attrs = InternalQuickIO.SafeGetAttributes(path, out win32Error); if (Equals(attrs, 0xffffffff)) { return(false); } if (!InternalHelpers.ContainsFileAttribute(FileAttributes.Directory, ( FileAttributes )attrs)) { return(true); } throw new UnmatchedFileSystemEntryTypeException(QuickIOFileSystemEntryType.File, QuickIOFileSystemEntryType.Directory, path); }