path

package
v0.7.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package path implements path related functions.

Index

Constants

View Source
const (
	// DotRepo is ".repo".
	DotRepo = ".repo"
)

Macros for path

Variables

This section is empty.

Functions

func Abs

func Abs(name string) (string, error)

Abs returns absolute path and will expend homedir if path has "~/' prefix.

func AbsJoin

func AbsJoin(dir, name string) (string, error)

AbsJoin returns absolute path, and use <dir> as parent dir for relative path.

func Exist

func Exist(name string) bool

Exist check if path is exist.

func ExpendHome

func ExpendHome(name string) (string, error)

ExpendHome expends path prefix "~/" to home dir.

func FindGitWorkSpace

func FindGitWorkSpace(dir string) (string, string, error)

FindGitWorkSpace walks to upper directories to find gitdir and worktree.

func FindTopDir

func FindTopDir(dir string) (string, error)

FindTopDir finds repo root path, where has a '.repo' subdir.

func HomeDir

func HomeDir() (string, error)

HomeDir returns home directory.

func IsDir

func IsDir(name string) bool

IsDir returns true if path is exist and is a directory.

func IsFile

func IsFile(name string) bool

IsFile returns true if path is exist and is a file.

func IsGitDir

func IsGitDir(dir string) bool

IsGitDir test whether dir is a valid git dir.

func SafeCreateParentDir

func SafeCreateParentDir(name string)

SafeCreateParentDir will create parent dir if not exist.

func SetHome

func SetHome(home string)

SetHome sets proper HOME environments.

func UnsetHome

func UnsetHome()

UnsetHome unsets HOME related environments.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL