pathjoin

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentDirectory added in v0.3.9

func CurrentDirectory() string

func DbPath added in v0.4.1

func DbPath(first, second string) string

func DbPaths added in v0.4.1

func DbPaths(locations ...string) string

func DirByStackSkip added in v0.5.2

func DirByStackSkip(stackSkip int) string

func FilePathOfCaller added in v0.3.9

func FilePathOfCaller(callerIndex int) string

func FixPath added in v0.2.7

func FixPath(
	isNormalizePlusLogPathFix,
	isExpand bool,
	location string,
) string

FixPath normalized or expand or both apply based on condition

func FixPathPtr added in v0.3.8

func FixPathPtr(
	isNormalizePlusLogPathFix,
	isExpand bool,
	location string,
) *string

FixPathPtr normalized or expand or both apply based on condition

func JoinBaseDirWithSep added in v0.2.5

func JoinBaseDirWithSep(
	isSkipEmpty,
	isExpandEnvVariables,
	isNormalizePlusLongPathFix bool,
	sep string,
	baseDir string,
	paths ...string,
) string

JoinBaseDirWithSep isNormalizePlusLongPathFix if true then for windows add UNC Location fix

Omits baseDir if not given

func JoinConditionalNormalizedExpandIf added in v0.2.6

func JoinConditionalNormalizedExpandIf(
	isNormalizePlusLongPathFix,
	isExpand bool,
	path1, path2 string,
) string

JoinConditionalNormalizedExpandIf normalized or expand or both apply based on condition

func JoinConditionalNormalizedThreeExpandIf added in v0.6.4

func JoinConditionalNormalizedThreeExpandIf(
	isNormalizePlusLongPathFix,
	isExpand bool,
	first, second, third string,
) string

JoinConditionalNormalizedThreeExpandIf normalized or expand or both apply based on condition

func JoinFix added in v0.3.9

func JoinFix(
	baseDir string,
	paths ...string,
) string

JoinFix

Items are applied with normalize, skip on empty path given

func JoinFixWithoutLongPath added in v0.3.9

func JoinFixWithoutLongPath(
	baseDir string,
	paths ...string,
) string

JoinFixWithoutLongPath

Items are applied with normalize, skip on empty path given

func JoinFixedIf added in v0.4.0

func JoinFixedIf(
	isFixed bool,
	baseDir string,
	paths ...string,
) string

JoinFixedIf

isNormalizePlusLongPathFix if true then for windows add UNC Location fix

func JoinFixedThree added in v0.6.4

func JoinFixedThree(
	first,
	second,
	third string,
) string

func JoinIf added in v0.3.3

func JoinIf(isNormalizePlusLongPathFix bool, path1, path2 string) string

JoinIf isNormalizePlusLongPathFix if true then for windows add UNC Location fix

func JoinNormalized

func JoinNormalized(
	first, second string,
) string

JoinNormalized normalized applied auto

func JoinNormalizedExpand added in v0.2.5

func JoinNormalizedExpand(
	path1, path2 string,
) string

JoinNormalizedExpand normalized and expand applied auto

func JoinNormalizedExpandIf added in v0.2.5

func JoinNormalizedExpandIf(
	isExpandNormalize bool, path1, path2 string,
) string

JoinNormalizedExpandIf normalized and expand applied if condition meets

func JoinNormalizedExpandThree added in v0.6.2

func JoinNormalizedExpandThree(
	first, second, third string,
) string

JoinNormalizedExpandThree normalized and expand applied auto

func JoinNormalizedIf added in v0.1.2

func JoinNormalizedIf(isNormalize bool, path1, path2 string) string

JoinNormalizedIf normalized applied auto

func JoinNormalizedThree added in v0.6.2

func JoinNormalizedThree(first, second, third string) string

JoinNormalizedThree normalized applied auto

func JoinNormalizedThreeExpandIf added in v0.6.4

func JoinNormalizedThreeExpandIf(
	isExpandNormalize bool,
	first, second, third string,
) string

JoinNormalizedThreeExpandIf normalized and expand applied if condition meets

func JoinNormalizedThreeIf added in v0.6.4

func JoinNormalizedThreeIf(
	isNormalize bool,
	first, second, third string,
) string

JoinNormalizedThreeIf normalized applied auto

func JoinPrefix added in v0.6.4

func JoinPrefix(
	prefix, main string,
) string

JoinPrefix

only adds prefix if not exist in main

func JoinPrefixSuffix added in v0.6.4

func JoinPrefixSuffix(
	prefix, main, suffix string,
) string

JoinPrefixSuffix

only adds prefix if not exist in main only adds suffix if not exist in main

func JoinPrefixSuffixIf added in v0.6.4

func JoinPrefixSuffixIf(
	isFix, isExpand bool,
	prefix, main, suffix string,
) string

JoinPrefixSuffixIf

only adds prefix if not exist in main (given empty prefix will ignore) only adds suffix if not exist in main (given empty suffix will ignore)

func JoinSimple

func JoinSimple(first, second string) string

JoinSimple doesn't apply normalize

func JoinSimpleBaseWithMany added in v0.7.0

func JoinSimpleBaseWithMany(
	baseDir string,
	relatives ...string,
) string

JoinSimpleBaseWithMany doesn't apply normalize

func JoinSimpleIf added in v0.3.6

func JoinSimpleIf(isUseLibraryFunc bool, path1, path2 string) string

JoinSimpleIf doesn't apply normalize

func JoinSimpleMany added in v0.7.0

func JoinSimpleMany(relatives ...string) string

JoinSimpleMany doesn't apply normalize

func JoinSimpleThree added in v0.6.4

func JoinSimpleThree(first, second, third string) string

JoinSimpleThree Doesn't apply normalize

func JoinSuffix added in v0.6.4

func JoinSuffix(
	main, suffix string,
) string

JoinSuffix

only adds suffix if not exist in main ending

func JoinWithBaseDirSep added in v0.7.0

func JoinWithBaseDirSep(
	isSkipEmpty,
	isExpandEnvVariables,
	isNormalizePlusLongPathFix bool,
	sep string,
	baseDir string,
	relativePaths ...string,
) string

JoinWithBaseDirSep

isNormalizePlusLongPathFix if true then for windows add UNC Location fix

func JoinWithCurDir added in v0.3.9

func JoinWithCurDir(
	isNormalize,
	isExpandEnv bool,
	paths ...string,
) string

func JoinWithCurDirUsingCallStack added in v0.4.0

func JoinWithCurDirUsingCallStack(
	isNormalize,
	isExpandEnv bool,
	frameStackSkip int,
	paths ...string,
) string

func JoinWithSep

func JoinWithSep(
	isSkipEmpty,
	isExpandEnvVariables,
	isNormalizePlusLongPathFix bool,
	sep string,
	relativePaths ...string,
) string

JoinWithSep isNormalizePlusLongPathFix if true then for windows add UNC Location fix

func JoinsNormalizedExpandIf added in v0.2.5

func JoinsNormalizedExpandIf(
	isExpandNormalize bool,
	baseDir string,
	relatives ...string,
) string

JoinsNormalizedExpandIf normalized and expand applied if condition meets

func JoinsNormalizedIf added in v0.2.5

func JoinsNormalizedIf(
	isNormalize bool,
	baseDir string,
	relatives ...string,
) string

JoinsNormalizedIf normalized and expand applied if condition meets

func TrimReplacePrefixRoot added in v0.4.3

func TrimReplacePrefixRoot(
	isNormalize,
	isLongPathForceFix bool,
	source,
	trimRootPrefix,
	rootReplacer string,
) string

func TrimReplacePrefixRootJoinSuffix added in v0.4.3

func TrimReplacePrefixRootJoinSuffix(
	isNormalize,
	isLongPathForceFix bool,
	source,
	trimRootPrefix,
	rootReplacer,
	suffixJoin string,
) string

func TrimReplacePrefixRootNormalized added in v0.4.9

func TrimReplacePrefixRootNormalized(
	source,
	trimRootPrefix,
	rootReplacer string,
) string

func TrimReplacePrefixRoots added in v0.4.3

func TrimReplacePrefixRoots(
	isNormalize,
	isLongPathForceFix bool,
	baseLocations []string,
	trimRootPrefix,
	rootReplacer string,
) []string

func WithRoot added in v0.2.8

func WithRoot(paths ...string) string

func WithTemp added in v0.2.7

func WithTemp(
	locations ...string,
) string

WithTemp

LongPath JoinFix, EnvVarExpand, skip on empty path

Windows
    - "%temp%\locations\..."
Unix
    - "/tmp/locations/..."

func WithTempPlus added in v0.2.7

func WithTempPlus(
	isNormalizeLongPathFix,
	isExpandEnvVar bool,
	baseDir string,
	locations ...string,
) string

WithTempPlus

skip on empty path and others optional

Windows
    - "%temp%\locations\..."
Unix
    - "/tmp/locations/..."

func WithTempPlusDefaults added in v0.2.7

func WithTempPlusDefaults(
	baseDir string,
	locations ...string,
) string

func WithTempTest added in v0.2.8

func WithTempTest(paths ...string) string

Types

type Joiner

type Joiner struct {
	// contains filtered or unexported fields
}

func EmptyJoiner

func EmptyJoiner() *Joiner

func NewJoiner

func NewJoiner(capacity int) *Joiner

func NewJoiner5

func NewJoiner5() *Joiner

func (*Joiner) Add

func (it *Joiner) Add(addingPath string) *Joiner

func (*Joiner) Adds

func (it *Joiner) Adds(addingPaths ...string) *Joiner

func (*Joiner) HasItems

func (it *Joiner) HasItems() bool

func (*Joiner) IsEmpty

func (it *Joiner) IsEmpty() bool

func (*Joiner) Length

func (it *Joiner) Length() int

func (*Joiner) OsSeparatorJoin added in v0.2.5

func (it *Joiner) OsSeparatorJoin(
	isExpandEnvVars,
	isNormalizePlusLongPathFix bool,
) string

OsSeparatorJoin

Usages osconsts.PathSeparator as separator

func (*Joiner) OsSeparatorJoinExpand added in v0.2.5

func (it *Joiner) OsSeparatorJoinExpand(
	isNormalizePlusLongPathFix bool,
) string

func (*Joiner) OsSeparatorJoinNormalized added in v0.2.5

func (it *Joiner) OsSeparatorJoinNormalized(
	isExpandEnvVars bool,
) string

func (Joiner) String

func (it Joiner) String() string

String normalize + expand and long path fix true

Usages osconsts.PathSeparator as separator

func (*Joiner) ToString

func (it *Joiner) ToString(
	isExpandEnvVars,
	isNormalizePlusLongPathFix bool,
	sep string,
) string

ToString isNormalizePlusLongPathFix if true then adds UNC path fix for Windows

Jump to

Keyboard shortcuts

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