Example #1
0
        private static bool ExistsCore(string fullPath, out bool isDirectory)
        {
            Interop.Kernel32.WIN32_FILE_ATTRIBUTE_DATA data = default;
            int  errorCode = FileSystem.FillAttributeInfo(fullPath, ref data, returnErrorOnNotFound: true);
            bool result    = (errorCode == Interop.Errors.ERROR_SUCCESS) && (data.dwFileAttributes != -1);

            isDirectory = result && (data.dwFileAttributes & Interop.Kernel32.FileAttributes.FILE_ATTRIBUTE_DIRECTORY) != 0;

            return(result);
        }
 public void Refresh()
 {
     // This should not throw, instead we store the result so that we can throw it
     // when someone actually accesses a property
     _dataInitialized = FileSystem.FillAttributeInfo(FullPath, ref _data, returnErrorOnNotFound: false);
 }