MCPcopy Create free account
hub / github.com/exercism/cli / Dir

Function Dir

config/config.go:54–77  ·  view source on GitHub ↗

Dir is the configured config home directory. All the cli-related config files live in this directory.

()

Source from the content-addressed store, hash-verified

52// Dir is the configured config home directory.
53// All the cli-related config files live in this directory.
54func Dir() string {
55 var dir string
56 if runtime.GOOS == "windows" {
57 dir = os.Getenv("APPDATA")
58 if dir != "" {
59 return filepath.Join(dir, DefaultDirName)
60 }
61 } else {
62 dir := os.Getenv("EXERCISM_CONFIG_HOME")
63 if dir != "" {
64 return dir
65 }
66 dir = os.Getenv("XDG_CONFIG_HOME")
67 if dir == "" {
68 dir = filepath.Join(os.Getenv("HOME"), ".config")
69 }
70 if dir != "" {
71 return filepath.Join(dir, DefaultDirName)
72 }
73 }
74 // If all else fails, use the current directory.
75 dir, _ = os.Getwd()
76 return dir
77}
78
79func userHome() string {
80 var dir string

Callers 1

NewConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected