| 13 | ) |
| 14 | |
| 15 | func initPath(cfg *core.Config) error { |
| 16 | // The first entry is always the default `StylesPath`. |
| 17 | stylesPath := cfg.StylesPath() |
| 18 | |
| 19 | if !system.IsDir(stylesPath) { |
| 20 | if err := os.MkdirAll(stylesPath, os.ModePerm); err != nil { |
| 21 | e := fmt.Errorf("unable to initialize StylesPath (value = '%s')", stylesPath) |
| 22 | return core.NewE100("initPath", e) |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | // Remove any existing .vale-config directory. |
| 27 | err := os.RemoveAll(filepath.Join(stylesPath, core.PipeDir)) |
| 28 | if err != nil { |
| 29 | return core.NewE100("initPath", err) |
| 30 | } |
| 31 | |
| 32 | return nil |
| 33 | } |
| 34 | |
| 35 | func readPkg(pkg, path string, idx int) error { |
| 36 | if core.IsPhrase(pkg) && !system.IsDir(pkg) { |