// IsWriter returns whether or not the given user is a writer for the
// top-level folder represented by this TlfHandle.
358030
func (h Handle) IsWriter(user keybase1.UID) bool {
	// TODO(KBFS-2185) relax this?
	if h.TypeForKeying() == tlf.TeamKeying {
		panic("Can't check whether a user is a writer on a team TLF")
	}
	_, ok := h.resolvedWriters[user.AsUserOrTeam()]
	return ok
}
729221
func isConsole(out io.Writer) bool {
	return out == os.Stdout || out == os.Stderr || out == os.Stdin
}
1357435
func IsDir(path string, fs afero.Fs) (bool, error) {
	return afero.IsDir(fs, path)
}
1057541
func (u *User) IsWriterOfRepo(repo *Repository) bool {
	has, err := HasAccess(u.ID, repo, ACCESS_MODE_WRITE)
	if err != nil {
		log.Error(2, "HasAccess: %v", err)
	}
	return has
}
5668
func (s *Store) IsDir(ctx context.Context, name string) bool {
	path := filepath.Join(s.path, filepath.Clean(name))
	isDir := fsutil.IsDir(path)
	out.Debug(ctx, "fs.Isdir(%s) - %s -> %t", name, path, isDir)
	return isDir
}
1011594
func IsDir(path string) bool {
	fi, err := os.Stat(path)
	if err != nil {
		if os.IsNotExist(err) {
			// not found
			return false
		}
		fmt.Printf("failed to check dir %s: %s\n", path, err)
		return false
	}

	return fi.IsDir()
}
512487
func (md *RootMetadataV2) IsReader(
	_ context.Context, user keybase1.UID, deviceKey kbfscrypto.CryptPublicKey,
	_ TeamMembershipChecker, _ ExtraMetadata,
	_ keybase1.OfflineAvailability) (bool, error) {
	switch md.ID.Type() {
	case tlf.Public:
		return true, nil
	case tlf.Private:
		return md.RKeys.IsReader(user, deviceKey), nil
	case tlf.SingleTeam:
		// There are no read-only users of single-team TLFs.
		return false, nil
	default:
		panic(fmt.Sprintf("Unexpected TLF type: %s", md.ID.Type()))
	}
}
305702
func (e *ephemeralGitConfigWithFixedPackWindow) PackfileWriter(
	ch plumbing.StatusChan) (io.WriteCloser, error) {
	return e.pfWriter.PackfileWriter(ch)
}
215325
func (s *S3Provider) Writer(path ...string) (io.WriteCloser, error) {
	s3FilePath := strings.Join(path, "/")
	s3, err := storage.SafeCreateS3Bucket(s.S3Domain, s.BucketName, s.AccessKeyID, s.SecretAccessKey)

	if err != nil {
		return nil, err
	}
	return s3.NewWriter(s3FilePath)
}
521865
func (fs *Filespace) Writer(subPath string) (filesystem.Writer, error) {
	return os.OpenFile(fs.path+subPath, os.O_WRONLY|os.O_CREATE, filesystem.DefaultUnixFileMode)
}
1002500
func (d DirentFileInfo) IsDir() bool {
	if d.Entry.DirentType == keybase1.DirentType_DIR {
		return true
	}
	return false
}
1110409
func StorageWriter(storage StorageAPI, volume, path string) io.Writer {
	return &storageWriter{storage, volume, path}
}
436082
func SetWriter(writer io.Writer) {
	oldWriter := logEnabled.writer
	logEnabled.writer = writer
	if cache, isCache := oldWriter.(*logCache); isCache {
		cache.Flush(logEnabled)
	}
}
1214546
func IsDir(fs Fs, path string) (bool, error) {
	fi, err := fs.Stat(path)
	if err != nil {
		return false, err
	}
	return fi.IsDir(), nil
}
1049215
func (s *Store) IsDir(ctx context.Context, name string) bool {
	name = s.prefix + name
	out.Debug(ctx, "consul.IsDir(%s)", name)
	count := 0
	ls, err := s.List(ctx, name)
	if err != nil {
		return false
	}
	for _, e := range ls {
		if strings.HasPrefix(e, name) {
			count++
		}
	}
	return count > 1
}
977831
func (d *driver) Writer(context context.Context, path string, append bool) (storagedriver.FileWriter, error) {
	writer := &writer{
		client: d.client,
		bucket: d.bucket,
		name:   d.pathToKey(path),
		buffer: make([]byte, d.chunkSize),
	}

	if append {
		err := writer.init(path)
		if err != nil {
			return nil, err
		}
	}
	return writer, nil
}
789351
func (s *File) NewWriter(id string) (io.WriteCloser, error) {
	const mod = os.O_WRONLY | os.O_CREATE | os.O_TRUNC
	name := s.Prefixed.Name(id)

	if filepath.Dir(name) == "." {
		return os.OpenFile(s.join(name), mod, 0600)
	} else if !s.AllowSub {
		return nil, errors.New("sub directories not allowed")
	}
	if err := os.MkdirAll(s.join(filepath.Dir(name)), 0700); err != nil {
		return nil, err
	}
	return os.OpenFile(s.join(name), mod, 0600)
}