migrate config files

This commit is contained in:
piotr
2021-09-25 03:44:38 +02:00
parent 62b7b4f90e
commit fb00364e51
3 changed files with 39 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ import (
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
"regexp"
"sort"
@@ -149,14 +150,24 @@ func readTextFile(path string) (string, error) {
return string(bytes), nil
}
func oldConfigDir() (string, error) {
if os.Getenv("XDG_CONFIG_HOME") != "" {
dir := path.Join(os.Getenv("XDG_CONFIG_HOME"), "nwg-panel")
return dir, nil
}
return "", errors.New("old config dir not found")
}
func configDir() string {
if os.Getenv("XDG_CONFIG_HOME") != "" {
dir := fmt.Sprintf("%s/nwg-panel", os.Getenv("XDG_CONFIG_HOME"))
dir := path.Join(os.Getenv("XDG_CONFIG_HOME"), "nwg-drawer")
createDir(dir)
return (fmt.Sprintf("%s/nwg-panel", os.Getenv("XDG_CONFIG_HOME")))
return dir
}
dir := fmt.Sprintf("%s/.config/nwg-panel", os.Getenv("HOME"))
dir := path.Join(os.Getenv("XDG_CONFIG_HOME"), "nwg-drawe")
createDir(dir)
return dir
}