// Writable ensures the directory exists and is writable
498976
func Writable(path string) error {
	// Construct the path if missing
	if err := os.MkdirAll(path, os.ModePerm); err != nil {
		return err
	}
	// Check the directory is writable
	if f, err := os.Create(filepath.Join(path, "._check_writable")); err == nil {
		f.Close()
		os.Remove(f.Name())
	} else {
		return errors.New("'" + path + "' is not writable")
	}
	return nil
}
936441
func (tlf *TLF) CanDeleteDirectory(ctx context.Context, fi *dokan.FileInfo) (err error) {
	return nil
}
408356
func NewTable(table string) *Table {
	tpb := TablePb{
		Name:         strings.ToLower(table),
		NameOriginal: table,
	}
	t := &Table{
		TablePb:  tpb,
		Fields:   make([]*Field, 0),
		FieldMap: make(map[string]*Field),
	}
	t.init(nil)
	return t
}
401770
func (m *MockCollection) Writeable() mongo.WriteCollection {
	ret := m.ctrl.Call(m, "Writeable")
	ret0, _ := ret[0].(mongo.WriteCollection)
	return ret0
}
725589
func (self *qbsWrapped) AllowWrite(pb PBundle) bool {
	allow, ok := self.post.(AllowWriter)
	if !ok {
		return true
	}
	return allow.AllowWrite(pb)
}
194323
func (e *Exportable) WriteFile(filename string, perm os.FileMode) error {
	return ioutil.WriteFile(filename, e.Bytes(), perm)
}
304133
func IsUpdateable(ctx context.Context) error {
	fn, err := executable(ctx)
	if err != nil {
		return err
	}
	out.Debug(ctx, "isUpdateable - File: %s", fn)
	// check if this is a test binary
	if strings.HasSuffix(filepath.Base(fn), ".test") {
		return nil
	}

	// check if we want to force updateability
	if uf := os.Getenv("GOPASS_FORCE_UPDATE"); uf != "" {
		out.Debug(ctx, "updateable due to force flag")
		return nil
	}

	// check if file is in GOPATH
	if gp := os.Getenv("GOPATH"); strings.HasPrefix(fn, gp) {
		return fmt.Errorf("use go get -u to update binary in GOPATH")
	}

	// check file
	fi, err := os.Stat(fn)
	if err != nil {
		return err
	}
	if !fi.Mode().IsRegular() {
		return fmt.Errorf("not a regular file")
	}
	if err := unix.Access(fn, unix.W_OK); err != nil {
		return err
	}

	// check dir
	fdir := filepath.Dir(fn)
	return unix.Access(fdir, unix.W_OK)
}
656497
func WriteFile(fs VFS, path string, data []byte, perm os.FileMode) error {
	f, err := fs.OpenFile(path, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, perm)
	if err != nil {
		return err
	}
	if _, err := f.Write(data); err != nil {
		f.Close()
		return err
	}
	return f.Close()
}
1270307
func isIterable(src interface{}) bool {
	if src == nil {
		return false
	}
	t := reflect.TypeOf(src)
	if t.Kind() == reflect.Ptr {
		t = t.Elem()
	}
	return t.Kind() == reflect.Slice || t.Kind() == reflect.Array
}
361033
func (_m *APIClient) PluginEnable(ctx context.Context, name string, options types.PluginEnableOptions) error {
	ret := _m.Called(ctx, name, options)

	var r0 error
	if rf, ok := ret.Get(0).(func(context.Context, string, types.PluginEnableOptions) error); ok {
		r0 = rf(ctx, name, options)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
736912
func ErrKubeConfigNotWriteable(file string, isExplicitFile bool, err error) error {
	return NewError("KUBECONFIG is set to a file that cannot be created or modified: %s", file).WithCause(err).WithSolution(kubeConfigSolution(isExplicitFile))
}
1072361
func (dir *Dir) WriteFile(fileName string, reader io.Reader) (file *File, err error) {
	if err = dir.createIfNoExist(); err == nil {
		relativeDir := strings.TrimPrefix(dir.DirPath, dir.Filebox.BaseDir)
		file = dir.Filebox.AccessFile(filepath.Join(relativeDir, fileName), dir.Roles...)
		err = file.Write(reader)
	}
	return
}
543098
func (f *FakeFS) MkdirAll(dirName string, perm os.FileMode) error {
	_, err := f.Create(dirName)
	return err
}
630588
func (p *printer) cachedWriteError() error {
	_, err := p.Write(nil)
	return err
}
787350
func (r *realFS) MkdirAll(dirName string, perm os.FileMode) error {
	return os.MkdirAll(dirName, perm)
}
253222
func NewTable() *ServiceCache {
	return &ServiceCache{
		local:       map[int]map[uint32]entryList{},
		remote:      map[int]map[uint32]entryList{},
		remoteHosts: map[string]entryList{},
		localHosts:  map[string]entryList{},
	}
}
1269323
func writeFully(w io.Writer, data []byte) error {
	offset := 0
	for offset < len(data) {
		n, err := w.Write(data[offset:])
		if err != nil {
			return errors.WrapErrorf(err, errors.NetworkError, "error writing %d bytes at offset %d", len(data), offset)
		}
		offset += n
	}
	return nil
}