move config to $HOME

This commit is contained in:
andrzej 2024-10-30 21:36:10 +01:00
parent 3d8197d7ae
commit d87664a9f4
4 changed files with 7 additions and 15 deletions

View File

@ -15,7 +15,12 @@ type Config struct {
}
func (config *Config) load() {
configRaw, err := os.ReadFile("./config.jsonc")
homeDir, err := os.UserHomeDir()
if err != nil {
log.Fatal("could not get home directory!", err)
}
configRaw, err := os.ReadFile(homeDir + "/.config/gopaper/config.jsonc")
if err != nil {
log.Fatal("Couldn't open config file!\n", err)
}
@ -26,10 +31,6 @@ func (config *Config) load() {
log.Fatal("Couldn't unmarshal config!\n", err)
}
homeDir, err := os.UserHomeDir()
if err != nil {
log.Fatal("could not get home directory!", err)
}
config.Cache = homeDir + "/" + config.Cache + "/"
//TODO: make directories if they don't
config.ImagesDir = homeDir + "/" + config.ImagesDir + "/"

View File

@ -1,9 +0,0 @@
//All directories are relevant to the home folder, and will be created if they do not exist
{
"colorize":[ 247,40,60 ],
"contrast":-35,
"gamma":0.8,
"imagesDir":"bgs",
"duration":10,
"cache":"slideshow" //this is where
}

BIN
go-img Executable file

Binary file not shown.

2
go.mod
View File

@ -1,4 +1,4 @@
module go-img
module gopaper
go 1.23.2