// NewFilePathName creates a new file with the specified package path and name.
493522
func NewFilePathName(packagePath, packageName string) *File {
	return &File{
		Group: &Group{
			multi: true,
		},
		name:    packageName,
		path:    packagePath,
		imports: map[string]importdef{},
		hints:   map[string]importdef{},
	}
}
871701
func (p *PathSpec) URLizeFilename(filename string) string {
	return p.URLEscape(filepath.ToSlash(filename))
}
124309
func (g *Generator) PackagePathAndName(pkg interface{}) (path string, name string) {
	switch p := pkg.(type) {
	case string:
		path = p
		pkgInfo, err := g.loadPackage(path)
		if err != nil { //extract name from the package path itself
			log.Fatalf("failed to import package %q: %v", path, err)
		}

		name = pkgInfo.Pkg.Name()
	case *types.Package:
		path = p.Path()
		name = p.Name()
	case *ast.ImportSpec:
		return g.PackagePathAndName(p.Path.Value[1 : len(p.Path.Value)-1])
	default:
		log.Fatalf("unsupported pkg type: %T", pkg)
	}

	return NormalizeImportPath(path), name
}
239896
func NewFile(path string, r io.Reader) *File {
	if r == nil {
		r = &bytes.Buffer{}
	}
	if seek, ok := r.(io.Seeker); ok {
		seek.Seek(0, 0)
	}
	abs := path
	if !filepath.IsAbs(path) {
		abs, _ = filepath.Abs(path)
	}
	return &File{
		Reader:  r,
		Path:    path,
		AbsPath: abs,
	}
}
1180318
func NewFile(fd uintptr, name string) *os.File {
	return newfile(fd, name)
}
923814
func NewFromPath(path string) Boxfile {
  raw, _ := ioutil.ReadFile(path)
  return New(raw)
}
939848
func NewPath(pathStr string) (Path, error) {
	components, err := split(pathStr)
	if err != nil {
		return Path{}, err
	}
	len := len(components)

	if (len >= 1 && components[0] != topName) ||
		(len >= 2 && components[1] != publicName && components[1] != privateName) {
		return Path{}, InvalidPathErr{pathStr}
	}

	if len == 0 {
		p := Path{
			PathType: RootPathType,
		}
		return p, nil
	}

	if len == 1 {
		p := Path{
			PathType: KeybasePathType,
		}
		return p, nil
	}

	if len == 2 {
		p := Path{
			PathType: KeybaseChildPathType,
			TLFType:  listTypeToTLFType(components[1]),
		}
		return p, nil
	}

	p := Path{
		PathType:      TLFPathType,
		TLFType:       listTypeToTLFType(components[1]),
		TLFName:       components[2],
		TLFComponents: components[3:],
	}
	return p, nil
}
632144
func PackageName(path string) (string, error) {
	fset := token.NewFileSet()
	pkgs, err := parser.ParseDir(fset, path, nil, parser.PackageClauseOnly)
	if err != nil {
		return "", err
	}
	var pkgNames []string
	for n := range pkgs {
		if !strings.HasSuffix(n, "_test") {
			pkgNames = append(pkgNames, n)
		}
	}
	if len(pkgNames) > 1 {
		return "", fmt.Errorf("more than one Go package found in %s (%s)",
			path, strings.Join(pkgNames, ","))
	}
	if len(pkgNames) == 0 {
		return "", fmt.Errorf("no Go package found in %s", path)
	}
	return pkgNames[0], nil
}
411621
func newFile(name, contents string) (*file, error) {
	if name == "" {
		return nil, fmt.Errorf("files cannot have empty names")
	}

	return &file{
		name:     name,
		contents: contents,
	}, nil
}
506685
func NewPath(s string) *Graph {
	p := NewParser(bytes.NewBuffer([]byte(s)))
	p.Path()
	g := p.Graph()
	g.This = TypePath
	return g
}
1357454
func (ij *isolatedFile) name() string {
	name := filepath.Base(ij.path)
	if i := strings.LastIndex(name, "."); i != -1 {
		name = name[:i]
	}
	return name
}
664087
func (s *DeleteFileOutput) SetFilePath(v string) *DeleteFileOutput {
	s.FilePath = &v
	return s
}
588267
func NewFileName(X *xgbutil.XUtil, fileName string) (*Image, error) {
	srcReader, err := os.Open(fileName)
	if err != nil {
		return nil, err
	}
	defer srcReader.Close()

	img, _, err := image.Decode(srcReader)
	if err != nil {
		return nil, err
	}
	return NewConvert(X, img), nil
}
931193
func New(filepath string) (ef File, err error) {
	file, err := os.Open(filepath)
	if err != nil {
		return
	}
	ef.file = file
	ef.ParseFileHeader()
	return
}
945120
func NewFilespace(path string) (filesystem.Filespace, error) {
	varutil.FixDirPath(&path)
	return filesystem.Filespace(&Filespace{
		path: path,
	}), nil
}
1054166
func (s *UpdateUserInput) SetNewPath(v string) *UpdateUserInput {
	s.NewPath = &v
	return s
}
1223485
func (s *PutFileEntry) SetFilePath(v string) *PutFileEntry {
	s.FilePath = &v
	return s
}