[Feature Request] XDG Compliance #1

Closed
opened 2021-03-17 02:59:35 +00:00 by BenEvolent333 · 1 comment
BenEvolent333 commented 2021-03-17 02:59:35 +00:00 (Migrated from github.com)

I modified the config.go file to add complaince for both XDG_CONFIG_HOME, or (if that variable is not set) "~/.config", both with the file at "/gostations/radiostations.ini". Here is the

diff --git a/config.go b/config.go
index d5e7730..8b89e21 100644
--- a/config.go
+++ b/config.go
@@ -22,6 +22,11 @@ func str2int(strnum string) int {
func Config(option string) (string, error) {
configparser.Delimiter = "="
configFile := "radiostations.ini"
+ xdgConfigPath := os.Getenv("XDG_CONFIG_HOME")
+ if xdgConfigPath == "" {
+ xdgConfigPath = "~/.config"
+ }
+ configFile = xdgConfigPath + "/gostations/" + configFile
runtimeSection := "DEFAULT"

config, err := configparser.Read(configFile)
@@ -59,4 +64,4 @@ func options() string {
func maxitems() int {
items, _ := Config("menu_items.max")
return str2int(items)
-}
\ No newline at end of file
+}

Sorry about the last part, I guess vim added a newline.

I modified the config.go file to add complaince for both XDG_CONFIG_HOME, or (if that variable is not set) "~/.config", both with the file at "/gostations/radiostations.ini". Here is the > diff --git a/config.go b/config.go index d5e7730..8b89e21 100644 --- a/config.go +++ b/config.go @@ -22,6 +22,11 @@ func str2int(strnum string) int { func Config(option string) (string, error) { configparser.Delimiter = "=" configFile := "radiostations.ini" \+ xdgConfigPath := os.Getenv("XDG_CONFIG_HOME") \+ if xdgConfigPath == "" { \+ xdgConfigPath = "~/.config" \+ } \+ configFile = xdgConfigPath + "/gostations/" + configFile > runtimeSection := "DEFAULT" > config, err := configparser.Read(configFile) @@ -59,4 +64,4 @@ func options() string { func maxitems() int { items, _ := Config("menu_items.max") return str2int(items) \-} \ No newline at end of file \+} Sorry about the last part, I guess vim added a newline.
gmgauthier commented 2021-03-17 07:22:18 +00:00 (Migrated from github.com)

I love it! Thanks! I'm definitely adding this.

I love it! Thanks! I'm definitely adding this.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: DemoReel/gostations#1
No description provided.