MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / Expand

Function Expand

internal/pathutil/pathutil.go:42–53  ·  view source on GitHub ↗

Expand resolves a leading "~" segment to the user's home directory. Inputs of "" return "" so callers can guard against missing config paths without an extra branch.

(path string)

Source from the content-addressed store, hash-verified

40// Inputs of "" return "" so callers can guard against missing config paths
41// without an extra branch.
42func Expand(path string) string {
43 if path == "" {
44 return ""
45 }
46 if path == "~" {
47 return Home()
48 }
49 if suffix, ok := strings.CutPrefix(path, "~/"); ok {
50 return joinHome(suffix)
51 }
52 return path
53}
54
55// ConfigDir returns the directory in which CAM stores its primary config files.
56// The CAM_CONFIG_DIR environment variable wins when set so tests can isolate

Callers 15

ApplyFunction · 0.92
codexPostWriteFunction · 0.92
resolveUserPathsMethod · 0.92
RunMethod · 0.92
isClaudePluginAppFunction · 0.92
LoadFunction · 0.92
BundledFunction · 0.92
TestExpandFunction · 0.92
InstructionPathFunction · 0.92
InstallToAppFunction · 0.92
UninstallFromAppFunction · 0.92
InstalledAppsForFunction · 0.92

Calls 2

HomeFunction · 0.85
joinHomeFunction · 0.85

Tested by 1

TestExpandFunction · 0.74