// Abs returne the source file absolute filename
14697
func (f *SourceFile) Abs() string {
	return filepath.Join(f.Package.Abs(), f.Name)
}
672838
func getDockerfileRelPath(absContextDir, givenDockerfile string) (string, error) {
	var err error

	if givenDockerfile == "-" {
		return givenDockerfile, nil
	}

	absDockerfile := givenDockerfile
	if absDockerfile == "" {
		// No -f/--file was specified so use the default relative to the
		// context directory.
		absDockerfile = filepath.Join(absContextDir, DefaultDockerfileName)

		// Just to be nice ;-) look for 'dockerfile' too but only
		// use it if we found it, otherwise ignore this check
		if _, err = os.Lstat(absDockerfile); os.IsNotExist(err) {
			altPath := filepath.Join(absContextDir, strings.ToLower(DefaultDockerfileName))
			if _, err = os.Lstat(altPath); err == nil {
				absDockerfile = altPath
			}
		}
	}

	// If not already an absolute path, the Dockerfile path should be joined to
	// the base directory.
	if !filepath.IsAbs(absDockerfile) {
		absDockerfile = filepath.Join(absContextDir, absDockerfile)
	}

	// Evaluate symlinks in the path to the Dockerfile too.
	//
	// FIXME. We use isUNC (always false on non-Windows platforms) to workaround
	// an issue in golang. On Windows, EvalSymLinks does not work on UNC file
	// paths (those starting with \\). This hack means that when using links
	// on UNC paths, they will not be followed.
	if !isUNC(absDockerfile) {
		absDockerfile, err = filepath.EvalSymlinks(absDockerfile)
		if err != nil {
			return "", errors.Errorf("unable to evaluate symlinks in Dockerfile path: %v", err)

		}
	}

	if _, err := os.Lstat(absDockerfile); err != nil {
		if os.IsNotExist(err) {
			return "", errors.Errorf("Cannot locate Dockerfile: %q", absDockerfile)
		}
		return "", errors.Errorf("unable to stat Dockerfile: %v", err)
	}

	relDockerfile, err := filepath.Rel(absContextDir, absDockerfile)
	if err != nil {
		return "", errors.Errorf("unable to get relative Dockerfile path: %v", err)
	}

	return relDockerfile, nil
}
1178750
func (p *Package) Abs() string {
	elem := "src" // GOPATH mode.
	if p.Workspace.isModuleMode {
		elem = "" // Module mode.
	}
	return filepath.Join(p.Workspace.Path, elem, p.Path)
}
49269
func FindCWD() (string, error) {
	serverFile, err := filepath.Abs(os.Args[0])

	if err != nil {
		return "", fmt.Errorf("can't get absolute path for executable: %v", err)
	}

	path := filepath.Dir(serverFile)
	realFile, err := filepath.EvalSymlinks(serverFile)

	if err != nil {
		if _, err = os.Stat(serverFile + ".exe"); err == nil {
			realFile = filepath.Clean(serverFile + ".exe")
		}
	}

	if err == nil && realFile != serverFile {
		path = filepath.Dir(realFile)
	}

	return path, nil
}
1373700
func absValue(needsAbs bool, value int64) int64 {
	if needsAbs && value < 0 {
		return -value
	}

	return value
}
1097852
func isExcluded(filePath string) bool {
	for _, p := range excludedPaths {
		absP, err := path.Abs(p)
		if err != nil {
			beeLogger.Log.Errorf("Cannot get absolute path of '%s'", p)
			continue
		}
		absFilePath, err := path.Abs(filePath)
		if err != nil {
			beeLogger.Log.Errorf("Cannot get absolute path of '%s'", filePath)
			break
		}
		if strings.HasPrefix(absFilePath, absP) {
			beeLogger.Log.Infof("'%s' is not being watched", filePath)
			return true
		}
	}
	return false
}
1099941
func fileBase(filePath string) string {
	fileName := path.Base(filePath)
	fileExt := path.Ext(filePath)

	return fileName[:len(fileName)-len(fileExt)]
}
713575
func (s *Folder) SetAbsolutePath(v string) *Folder {
	s.AbsolutePath = &v
	return s
}
620845
func Abs(path string) string {
	var abs string
	cwd, _ := os.Getwd()

	if path == "" || path == "." {
		abs = cwd

	} else if path == ".." {
		abs = filepath.Join(cwd, path)

	} else if strings.HasPrefix(path, "~/") {
		abs = filepath.Join(UserDir(), path[2:])

	} else if strings.HasPrefix(path, "./") {
		abs = filepath.Join(cwd, path[2:])

	} else if strings.HasPrefix(path, "../") {
		abs = filepath.Join(cwd, "..", path[2:])

	} else {
		return path
	}
	return abs
}
1182079
func augPath(base string, parts ...string) string {
	cpath := make([]string, 0, len(parts)+1)
	cpath = append(cpath, base)
	cpath = append(cpath, parts...)
	return filepath.Join(cpath...)
}
709339
func getAbsolutePath(p string) (string, error) {
	root, err := git.RootDir()
	if err != nil {
		return "", err
	}

	return filepath.Join(root, p), nil
}
1248986
func (z *Dec) Abs(x *Dec) *Dec {
	z.SetScale(x.Scale())
	z.UnscaledBig().Abs(x.UnscaledBig())
	return z
}
959939
func (dal *tDjangoAssetLoader) Abs(base, name string) string {
	if stdPath.IsAbs(name) {
		return name
	}

	return stdPath.Join(dal.baseDir, name)
}
826373
func makeAbsolute(dest, workingDir string) string {
	// Twiddle the destination when its a relative path - meaning, make it
	// relative to the WORKINGDIR
	if dest == "." {
		if !hasSlash(workingDir) {
			workingDir += string(os.PathSeparator)
		}
		dest = workingDir
	}

	if !filepath.IsAbs(dest) {
		hasSlash := hasSlash(dest)
		dest = filepath.Join(string(os.PathSeparator), filepath.FromSlash(workingDir), dest)

		// Make sure we preserve any trailing slash
		if hasSlash {
			dest += string(os.PathSeparator)
		}
	}
	return dest
}
1116577
func (m Mat3x2) Abs() Mat3x2 {
	return Mat3x2{Abs(m[0]), Abs(m[1]), Abs(m[2]), Abs(m[3]), Abs(m[4]), Abs(m[5])}
}
540419
func get_executable_filename() string {
	// try readlink first
	path, err := os.Readlink("/proc/self/exe")
	if err == nil {
		return path
	}
	// use argv[0]
	path = os.Args[0]
	if !filepath.IsAbs(path) {
		cwd, _ := os.Getwd()
		path = filepath.Join(cwd, path)
	}
	if file_exists(path) {
		return path
	}
	// Fallback : use "gocode" and assume we are in the PATH...
	path, err = exec.LookPath("gocode")
	if err == nil {
		return path
	}
	return ""
}
376248
func abs(slice []float64) []float64 {
	var newSlice []float64
	for _, value := range slice {
		if value < 0.0 {
			value = math.Abs(value)
		}
		newSlice = append(newSlice, value)
	}
	return newSlice
}