// File returns an os.File against an existing file.
542273
func (p *parserMixin) File() (target **os.File) {
	target = new(*os.File)
	p.FileVar(target)
	return
}
269579
func Executable() (string, error) {
	p, err := executable()
	return filepath.Clean(p), err
}
58688
func (f *File) Save(path string) (err error) {
	var target *os.File

	target, err = os.Create(path)
	if err != nil {
		return
	}

	err = f.Write(target)
	if err != nil {
		return
	}

	return target.Close()
}
31520
func Create(fn string) (*os.File, error) {
	tfn := strings.TrimSpace(fn)
	f, err := os.Create(tfn)
	if err != nil {
		return f, err
	}

	return f, nil
}
195790
func Open(filename string) (*os.File, error) {
	return OpenFile(filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)
}
1136681
func (s Status) File(path string) *FileStatus {
	if _, ok := (s)[path]; !ok {
		s[path] = &FileStatus{Worktree: Untracked, Staging: Untracked}
	}

	return s[path]
}
418816
func (of *OVAFile) Read(b []byte) (int, error) {
	if of.tarFile == nil {
		return 0, io.EOF
	}
	return of.tarFile.Read(b)
}
791955
func copyFile(w io.Writer, file string) error {
	f, err := os.Open(file)
	if err != nil {
		return err
	}
	defer f.Close()
	_, err = io.Copy(w, f)
	return err
}
749132
func (fs *FS) File(inode uint32) (*File, error) {
	g, ioff, err := fs.igroup(inode)
	if err != nil {
		return nil, err
	}

	addr := int64(fs.BlockSize) * int64(g.Inodeaddr+ioff/fs.inodesPerBlock)
	ivoff := (ioff % fs.inodesPerBlock) * fs.inodeSize

	file := &File{fs: fs, inum: inode}
	if _, err := fs.read(addr, int(ivoff), &file.ino); err != nil {
		return nil, err
	}

	switch file.ino.Mode & ifmt {
	case ififo, ifchr, ifdir, ifblk, ifreg, iflnk, ifsock:
		// okay
	default:
		return nil, fmt.Errorf("invalid inode mode %#x", file.ino.Mode)
	}

	return file, nil
}
58622
func (fs *FS) Open(filename string) (billy.File, error) {
	return fs.OpenFile(filename, os.O_RDONLY, 0600)
}
734611
func (r *Response) File(path string) error {
	abspath, err := filepath.Abs(path)

	if err != nil {
		return err
	}

	if !r.fileExists(abspath) {
		return err
	}

	r.file = abspath
	return nil
}
250977
func (f *File) Stat() (os.FileInfo, error) {
	if f.appendedF != nil {
		if f.appendedF.dir {
			return f.appendedF.dirInfo, nil
		}
		if f.appendedFileReader == nil {
			return nil, errors.New("file is closed")
		}
		return f.appendedF.zipFile.FileInfo(), nil
	}
	if f.virtualF != nil {
		return f.virtualF.stat()
	}
	if f.virtualD != nil {
		return f.virtualD.stat()
	}
	return f.realF.Stat()
}
368197
func (f File) Bytes() []byte {
	b, err := ioutil.ReadFile(f.Path)
	must(f.Case.T, err)
	return b
}
1098134
func (f *FileStore) Files() []TSMFile {
	f.mu.RLock()
	defer f.mu.RUnlock()
	return f.files
}
837323
func (f *File) Copy() (*File, error) {
	var datacopy = make([]byte, len(f.data))
	copy(datacopy[:], f.data)
	return &File{
		name:     f.name,
		filemode: f.filemode,
		time:     f.time,
		data:     datacopy,
	}, nil
}
1042310
func File(name string, reader io.Reader) p.Plugin {
	return p.NewRequestPlugin(func(ctx *c.Context, h c.Handler) {
		file := FormFile{name, reader}
		data := FormData{Files: []FormFile{file}}
		handle(ctx, h, data)
	})
}
1008504
func (d *Dir) addFile(root string, p string, fi os.FileInfo, err error) error {
	// See if the path exists
	var exists bool
	exists, err = PathExists(p)
	if err != nil {
		return err
	}

	if !exists {
		err = fmt.Errorf("%s does not exist", p)
		return err
	}

	rel := ""
	// Get the relative information.
	rel, err = filepath.Rel(root, p)
	if err != nil {
		return err
	}

	// skip relative root
	if rel == "." {
		return nil
	}

	d.Files = append(d.Files, file{Path: rel, Info: fi})

	return nil
}