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)
| 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. |
| 176 | func 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. |
| 192 | func resolveTaskDir() string { |
no outgoing calls