Add code to retrieve the correct user directory on windows and linux ... and a somewhat okayish directory on macos"
ADD
internal/config/config.go
+package config
+
+import "strings"
+
+var (
+ //AppName is the name representing the application.
+ AppName = "Cordless"
+ //AppNameLowercase is the representative name, but lowercase.
+ //It us used for filepaths and such.
+ AppNameLowercase = strings.ToLower(AppName)
+)
+
+//Config contains all possible configuration for the application.
+type Config struct {
+ Token string
+}
+
+var cachedConfigDir string
+
+//GetConfigDirectory is the parent directory in the os, that contains the
+//settings for the application.
+func GetConfigDirectory() (string, error) {
+ if cachedConfigDir != "" {
+ return cachedConfigDir, nil
+ }
+
+ directory, err := getConfigDirectory()
+ if err != nil {
+ return "", err
+ }
+
+ cachedConfigDir = directory
+ return cachedConfigDir, nil
+}

ADD
internal/config/os_darwin.go
+package config
+
+import (
+ "os/user"
+ "path/filepath"
+)
+
+func getConfigDirectory() (string, error) {
+ //TODO Gotta research this
+
+ currentUser, userError := user.Current()
+
+ if userError != nil {
+ return "", userError
+ }
+
+ return filepath.Join(currentUser.HomeDir, "."+AppNameLowercase), nil
+}

ADD
internal/config/os_linux.go
+package config
+
+import (
+ "os"
+ "os/user"
+ "path/filepath"
+)
+
+func getConfigDirectory() (string, error) {
+ configDir := os.Getenv("XDG_CONFIG_DIR")
+
+ if configDir != "" {
+ return configDir, nil
+ }
+
+ currentUser, userError := user.Current()
+
+ if userError != nil {
+ return "", userError
+ }
+
+ return filepath.Join(currentUser.HomeDir, ".config", AppNameLowercase), nil
+}

ADD
internal/config/os_windows.go
+package config
+
+import (
+ "os"
+ "os/user"
+ "path/filepath"
+)
+
+func getConfigDirectory() (string, error) {
+ configDir := os.Getenv("APPDATA")
+
+ if configDir != "" {
+ return filepath.Join(configDir, AppNameLowercase), nil
+ }
+
+ currentUser, userError := user.Current()
+
+ if userError != nil {
+ return "", userError
+ }
+
+ return filepath.Join(currentUser.HomeDir, "AppData", "Roaming", AppNameLowercase), nil
+}

Add code to retrieve the correct user directory on windows and linux ... and a somewhat okayish directory on macos"