Merge pull request #238 from stokito/leftovers

Use standard Go functions
This commit is contained in:
bradley
2020-11-29 09:06:13 -05:00
committed by GitHub
4 changed files with 9 additions and 13 deletions

View File

@@ -3,6 +3,7 @@ package config
import (
"fmt"
"os"
"path/filepath"
"regexp"
"strings"
@@ -81,7 +82,7 @@ func Write() (path string, err error) {
return path, err
}
cfgdir := basedir(path)
cfgdir := filepath.Dir(path)
// create config dir if not exist
if _, err := os.Stat(cfgdir); err != nil {
err = os.MkdirAll(cfgdir, 0755)
@@ -141,8 +142,3 @@ func xdgSupport() bool {
}
return false
}
func basedir(path string) string {
parts := strings.Split(path, "/")
return strings.Join((parts[0 : len(parts)-1]), "/")
}