fix: use filepath.Dir instead of path.Dir

Use the `filepath` implementation of `Dir` instead of `path`. Resolve
path resolution with Windows paths containing `\\` separators.
This commit is contained in:
Christopher Murphy 2022-09-15 17:41:28 -06:00 committed by Christian Muehlhaeuser
parent 7f810bfc9f
commit e0d667a48c

View file

@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path"
"path/filepath"
"github.com/charmbracelet/charm/ui/common"
gap "github.com/muesli/go-app-paths"
@ -53,7 +54,7 @@ var configCmd = &cobra.Command{
if _, err := os.Stat(configFile); os.IsNotExist(err) {
// File doesn't exist yet, create all necessary directories and
// write the default config file
if err := os.MkdirAll(path.Dir(configFile), 0700); err != nil {
if err := os.MkdirAll(filepath.Dir(configFile), 0700); err != nil {
return err
}