aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-05-20 20:20:20 +0200
committerJoe <rbo@gmx.us>2024-05-20 20:20:20 +0200
commita85e703ec8a926b0bea299b8984b2bbed19e4f65 (patch)
tree7a60094b4c6a0a64c14064788fd8c30dc92b4aac
parentgo (diff)
downloadhardflip-a85e703ec8a926b0bea299b8984b2bbed19e4f65.tar.gz
hardflip-a85e703ec8a926b0bea299b8984b2bbed19e4f65.tar.bz2
hardflip-a85e703ec8a926b0bea299b8984b2bbed19e4f65.tar.xz
hardflip-a85e703ec8a926b0bea299b8984b2bbed19e4f65.tar.zst
hardflip-a85e703ec8a926b0bea299b8984b2bbed19e4f65.zip
bugfix
-rw-r--r--Makefile11
-rw-r--r--src/c_init.go7
-rw-r--r--src/i_ui.go1
3 files changed, 12 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 276836f..77c9f62 100644
--- a/Makefile
+++ b/Makefile
@@ -20,8 +20,10 @@ TARGET := hf
SHELL := /bin/sh
SRC_DIR := ./src/
SRC_NAME := *.go
-SRC = $(addprefix ${SRC_DIR}, ${SRC_NAME})
+CONF_DIR := ./src/
+SRC := $(addprefix ${SRC_DIR}, ${SRC_NAME})
DEST := /usr
+XDG_CONFIG_HOME ?= $(HOME)/.config
.DEFAULT_GOAL := ${TARGET}
run: ${SRC}
@@ -31,11 +33,14 @@ ${TARGET}: ${SRC}
go build -o ${TARGET} ${SRC_DIR}
install:
- mkdir -p ${DEST}/bin
- cp -f ${TARGET} ${DEST}/bin
+ # mkdir -p ${DEST}/bin
+ # cp -f ${TARGET} ${DEST}/bin
# man shit
# mkdir -p $(DESTDIR)/share/man/man1
# cp -f man/lowbat.1 $(DESTDIR)/share/man/man1/lowbat.1
+ # mkdir -p $(XDG_CONFIG_HOME)/hf
+ # cp -f $(CONF_DIR)/* $(XDG_CONFIG_HOME)/hf
+ # cp -f $(CONF_DIR)/config.sample.yml $(XDG_CONFIG_HOME)/config.yml
clean:
go clean
diff --git a/src/c_init.go b/src/c_init.go
index 58b71c5..130ca96 100644
--- a/src/c_init.go
+++ b/src/c_init.go
@@ -179,18 +179,19 @@ func c_write_styles(file string, opts HardStyle, load_err *[]error) {
}
func c_get_options(dir string, load_err *[]error) HardOpts {
- opts := HardOpts{}
+ opts := DEFAULT_OPTS
file := dir + "/" + CONF_FILE_NAME
if _, err := os.Stat(file); os.IsNotExist(err) {
c_write_options(file, DEFAULT_OPTS, load_err)
- return DEFAULT_OPTS
+ opts.file = file
+ return opts
}
opts, err := c_parse_opts(file)
opts.file = file
if err != nil {
*load_err = append(*load_err, err)
- return DEFAULT_OPTS
+ return opts
}
return opts
}
diff --git a/src/i_ui.go b/src/i_ui.go
index 776988d..21df155 100644
--- a/src/i_ui.go
+++ b/src/i_ui.go
@@ -784,7 +784,6 @@ func i_ui(data_dir string) {
opts = DEFAULT_OPTS
} else {
opts = c_get_options(conf_dir, &load_err)
- // FIX: options not written correctly on welcome mode + void
}
styles := c_get_styles(conf_dir, &load_err)
i_init_styles(&ui, styles)