From e0d667a48c914ef517fdf35d07ae2ab8bdcb7959 Mon Sep 17 00:00:00 2001 From: Christopher Murphy Date: Thu, 15 Sep 2022 17:41:28 -0600 Subject: [PATCH] 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. --- config_cmd.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config_cmd.go b/config_cmd.go index a90b903..22c3825 100644 --- a/config_cmd.go +++ b/config_cmd.go @@ -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 }