MCPcopy Create free account
hub / github.com/driangle/taskmd / resolveRelativeToConfig

Function resolveRelativeToConfig

apps/cli/internal/cli/root.go:176–189  ·  view source on GitHub ↗

resolveRelativeToConfig resolves a relative path against the config file's directory. If the path is absolute, or no config file is loaded, it is returned unchanged.

(dir string)

Source from the content-addressed store, hash-verified

174// resolveRelativeToConfig resolves a relative path against the config file's directory.
175// If the path is absolute, or no config file is loaded, it is returned unchanged.
176func resolveRelativeToConfig(dir string) string {
177 if filepath.IsAbs(dir) {
178 return dir
179 }
180 configFile := viper.ConfigFileUsed()
181 if configFile == "" {
182 return dir
183 }
184 configDir, err := filepath.Abs(filepath.Dir(configFile))
185 if err != nil {
186 return dir
187 }
188 return filepath.Join(configDir, dir)
189}
190
191// resolveTaskDir determines the task directory using proper precedence.
192func resolveTaskDir() string {

Calls

no outgoing calls