Dir returns ~/.cloudcent, creating it if needed.
()
| 16 | |
| 17 | // Dir returns ~/.cloudcent, creating it if needed. |
| 18 | func Dir() (string, error) { |
| 19 | home, err := os.UserHomeDir() |
| 20 | if err != nil { |
| 21 | return "", fmt.Errorf("failed to get home directory: %w", err) |
| 22 | } |
| 23 | dir := filepath.Join(home, ".cloudcent") |
| 24 | if err := os.MkdirAll(dir, 0o700); err != nil { |
| 25 | return "", fmt.Errorf("failed to create config directory: %w", err) |
| 26 | } |
| 27 | return dir, nil |
| 28 | } |
| 29 | |
| 30 | // Path returns the full path to config.yaml. |
| 31 | func Path() (string, error) { |
no outgoing calls
no test coverage detected