// RelativePathToTarget returns the relative path to the given path, wether it's
// an import path or direct path and also returns if the path had recursion
// requested (/...).
338693
func RelativePathToTarget(path string) (rel string, recurse bool, err error) {
	// Detect recursion
	if strings.HasSuffix(path, string(os.PathSeparator)+"...") {
		recurse = true
		path = path[:len(path)-len(string(os.PathSeparator)+"...")]
	}

	// If path is unset, use local directory
	if path == "" || path == "." {
		return ".", recurse, nil
	}

	if _, err := os.Stat(path); err != nil {
		if perr, ok := err.(*os.PathError); ok {
			if serr, ok := perr.Err.(syscall.Errno); ok {
				if serr == syscall.ENOENT { // we might be given a import path.
					var err error
					path, err = findRelativeFromImport(path)
					if err != nil {
						return "", false, err
					}
					return path, recurse, nil
				}
			}
		}
		return "", false, err
	}
	return path, recurse, nil
}
106931
func (b *RouteBuilder) Path(subPath string) *RouteBuilder {
	b.currentPath = subPath
	return b
}
581787
func (s *AutomationExecutionMetadata) SetTarget(v string) *AutomationExecutionMetadata {
	s.Target = &v
	return s
}
1121679
func (s *GetSigningPlatformOutput) SetTarget(v string) *GetSigningPlatformOutput {
	s.Target = &v
	return s
}
556634
func ExecPath(path string) ExecAllocatorOption {
	return func(a *ExecAllocator) {
		// Convert to an absolute path if possible, to avoid
		// repeated LookPath calls in each Allocate.
		if fullPath, _ := exec.LookPath(path); fullPath != "" {
			a.execPath = fullPath
		} else {
			a.execPath = path
		}
	}
}
579097
func (launcher *Launcher) GetTarget() string {
	launcher.Mutex.RLock()
	arg := launcher.target
	launcher.Mutex.RUnlock()
	return arg
}
585731
func (tr *Repo) RemoveTargets(role data.RoleName, targets ...string) error {
	cantSignErr := tr.VerifyCanSign(role)
	if _, ok := cantSignErr.(data.ErrInvalidRole); ok {
		return cantSignErr
	}
	var needSign bool
	removeTargetVisitor := func(targetPath string) func(*data.SignedTargets, data.DelegationRole) interface{} {
		return func(tgt *data.SignedTargets, validRole data.DelegationRole) interface{} {
			// We've already validated the role path in our walk, so just modify the metadata
			// We don't check against the target path against the valid role paths because it's
			// possible we got into an invalid state and are trying to fix it
			if _, needSign = tgt.Signed.Targets[targetPath]; needSign && cantSignErr == nil {
				delete(tgt.Signed.Targets, targetPath)
				tgt.Dirty = true
			}
			return StopWalk{}
		}
	}

	// if the role exists but metadata does not yet, then our work is done
	_, ok := tr.Targets[role]
	if ok {
		for _, path := range targets {
			tr.WalkTargets("", role, removeTargetVisitor(path))
			if needSign && cantSignErr != nil {
				return cantSignErr
			}
		}
	}

	return nil
}
420771
func IsRelativePath(pth string) bool {
	if strings.HasPrefix(pth, "./") {
		return true
	}

	if strings.HasPrefix(pth, "/") {
		return false
	}

	if strings.HasPrefix(pth, "$") {
		return false
	}

	return true
}
514687
func (h *HTTPBin) RelativeRedirect(w http.ResponseWriter, r *http.Request) {
	doRedirect(w, r, true)
}
509980
func (ctx *Context) findImportPath(dir string) (importPath, gopath string, err error) {
	dirResolved, err := filepath.EvalSymlinks(dir)
	if err != nil {
		return "", "", err
	}
	dirs := make([]string, 1)
	dirs = append(dirs, dir)
	if dir != dirResolved {
		dirs = append(dirs, dirResolved)
	}

	for _, gopath := range ctx.GopathList {
		for _, dir := range dirs {
			if pathos.FileHasPrefix(dir, gopath) || pathos.FileStringEquals(dir, gopath) {
				importPath = pathos.FileTrimPrefix(dir, gopath)
				importPath = pathos.SlashToImportPath(importPath)
				return importPath, gopath, nil
			}
		}
	}
	return "", "", ErrNotInGOPATH{dir}
}
62642
func (o *VPort) RedirectionTargets(info *bambou.FetchingInfo) (RedirectionTargetsList, *bambou.Error) {

	var list RedirectionTargetsList
	err := bambou.CurrentSession().FetchChildren(o, RedirectionTargetIdentity, &list, info)
	return list, err
}
853360
func (u *Update) Target(path string) *Update {
	u.TargetPath = path
	return u
}
311062
func (tracker *DefaultImportTracker) PathOf(localName string) (string, bool) {
	name, ok := tracker.nameToPath[localName]
	return name, ok
}
531079
func setApplicationPath(c *model.CommandConfig) (err error) {

	// revel/revel#1014 validate relative path, we cannot use built-in functions
	// since Go import path is valid relative path too.
	// so check basic part of the path, which is "."
	if filepath.IsAbs(c.ImportPath) || strings.HasPrefix(c.ImportPath, ".") {
		utils.Logger.Fatalf("Abort: '%s' looks like a directory.  Please provide a Go import path instead.",
			c.ImportPath)
	}

	// If we are running a vendored version of Revel we do not need to check for it.
	if !c.New.Vendored {
		_, err = build.Import(model.RevelImportPath, "", build.FindOnly)
		if err != nil {
			//// Go get the revel project
			err = c.PackageResolver(model.RevelImportPath)
			if err != nil {
				return utils.NewBuildIfError(err, "Failed to fetch revel "+model.RevelImportPath)
			}
		}
	}

	c.AppName = filepath.Base(c.AppPath)

	return nil
}
803319
func (r *RepoStatus) GetTargetURL() string {
	if r == nil || r.TargetURL == nil {
		return ""
	}
	return *r.TargetURL
}
839798
func (p Path) ChildPath(name string, ptr BlockPointer) Path {
	child := Path{
		FolderBranch: p.FolderBranch,
		Path:         make([]PathNode, len(p.Path), len(p.Path)+1),
	}
	copy(child.Path, p.Path)
	child.Path = append(child.Path, PathNode{Name: name, BlockPointer: ptr})
	return child
}
101959
func (s *SubModule) SetRelativePath(v string) *SubModule {
	s.RelativePath = &v
	return s
}