From 1f27cf5b0070e8ce760027de910f8231e1a97270 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Fri, 3 Aug 2018 05:31:31 -0700 Subject: [PATCH] Clean up the code in cfg/ a bit --- cfg/config_files.go | 13 ++++++++----- main.go | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cfg/config_files.go b/cfg/config_files.go index 5bce14f3..149f4938 100644 --- a/cfg/config_files.go +++ b/cfg/config_files.go @@ -10,16 +10,19 @@ import ( "github.com/senorprogrammer/wtf/wtf" ) -const CONFIG_DIR_V1 = "~/.wtf/" -const CONFIG_DIR_V2 = "~/.config/wtf/" +// ConfigDirV1 defines the path to the first version of configuration. Do not use this +const ConfigDirV1 = "~/.wtf/" + +// ConfigDirV2 defines the path to the second version of the configuration. Use this. +const ConfigDirV2 = "~/.config/wtf/" /* -------------------- Config Migration -------------------- */ // MigrateOldConfig copies any existing configuration from the old location // to the new, XDG-compatible location func MigrateOldConfig() { - srcDir, _ := wtf.ExpandHomeDir(CONFIG_DIR_V1) - destDir, _ := wtf.ExpandHomeDir(CONFIG_DIR_V2) + srcDir, _ := wtf.ExpandHomeDir(ConfigDirV1) + destDir, _ := wtf.ExpandHomeDir(ConfigDirV2) // If the old config directory doesn't exist, do not move if _, err := os.Stat(srcDir); os.IsNotExist(err) { @@ -52,7 +55,7 @@ func MigrateOldConfig() { // ConfigDir returns the absolute path to the configuration directory func ConfigDir() (string, error) { - configDir, err := wtf.ExpandHomeDir(CONFIG_DIR_V2) + configDir, err := wtf.ExpandHomeDir(ConfigDirV2) if err != nil { return "", err } diff --git a/main.go b/main.go index 2dab3e42..9d3bb9cb 100644 --- a/main.go +++ b/main.go @@ -53,6 +53,7 @@ import ( var focusTracker wtf.FocusTracker var widgets []wtf.Wtfable +// Config parses the config.yml file and makes available the settings within var Config *config.Config var (