diff --git a/src/config.go b/src/config.go index 2b37a62..0edb46d 100644 --- a/src/config.go +++ b/src/config.go @@ -43,10 +43,15 @@ func readConfig() { } configPaths := make([]string, 0) - if runtime.GOOS == "windows" { + switch runtime.GOOS { + case "windows": configPaths = append(configPaths, filepath.Join(homeDir, "AppData/Roaming/Typer/config.yml")) configPaths = append(configPaths, filepath.Join(filepath.Dir(execPath), "etc/typer/config.yml")) - } else { + case "darwin": + configPaths = append(configPaths, filepath.Join(homeDir, "Library/Typer/config.yml")) + configPaths = append(configPaths, "/Library/Typer/config.yml") + configPaths = append(configPaths, filepath.Join(sysconfdir, "typer/config.yml")) + default: configPaths = append(configPaths, filepath.Join(homeDir, ".config/typer/config.yml")) configPaths = append(configPaths, filepath.Join(sysconfdir, "typer/config.yml")) } diff --git a/src/keybindings.go b/src/keybindings.go index 63bc8c9..37b15f5 100644 --- a/src/keybindings.go +++ b/src/keybindings.go @@ -39,10 +39,15 @@ func readKeybindings() { } configPaths := make([]string, 0) - if runtime.GOOS == "windows" { + switch runtime.GOOS { + case "windows": configPaths = append(configPaths, filepath.Join(homeDir, "AppData/Roaming/Typer/keybindings.yml")) configPaths = append(configPaths, filepath.Join(filepath.Dir(execPath), "etc/typer/keybindings.yml")) - } else { + case "darwin": + configPaths = append(configPaths, filepath.Join(homeDir, "Library/Typer/keybindings.yml")) + configPaths = append(configPaths, "/Library/Typer/keybindings.yml") + configPaths = append(configPaths, filepath.Join(sysconfdir, "typer/keybindings.yml")) + default: configPaths = append(configPaths, filepath.Join(homeDir, ".config/typer/keybindings.yml")) configPaths = append(configPaths, filepath.Join(sysconfdir, "typer/keybindings.yml")) } diff --git a/src/style.go b/src/style.go index df15c11..722a378 100644 --- a/src/style.go +++ b/src/style.go @@ -84,10 +84,15 @@ func readStyles() { } stylesPaths := make([]string, 0) - if runtime.GOOS == "windows" { + switch runtime.GOOS { + case "windows": stylesPaths = append(stylesPaths, filepath.Join(homeDir, "AppData/Roaming/Typer/styles")) - stylesPaths = append(stylesPaths, filepath.Join(filepath.Dir(execPath), "etc/typer/styles")) - } else { + stylesPaths = append(stylesPaths, filepath.Join(filepath.Dir(execPath), "config/styles")) + case "darwin": + stylesPaths = append(stylesPaths, filepath.Join(homeDir, "Library/Typer/styles")) + stylesPaths = append(stylesPaths, "/Library/Typer/styles") + stylesPaths = append(stylesPaths, filepath.Join(sysconfdir, "typer/styles")) + default: stylesPaths = append(stylesPaths, filepath.Join(homeDir, ".config/typer/styles")) stylesPaths = append(stylesPaths, filepath.Join(sysconfdir, "typer/styles")) }