From 02a279242425e5b07ad69d7bcc8c35432c6a1c7a Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" Date: Wed, 29 Apr 2020 12:07:37 -0500 Subject: [PATCH] Have -C look in the usual directories (not always absolute path) --- CHANGELOG.md | 1 + config.go | 7 ++++++- go.mod | 2 +- go.sum | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b7f93c..316e451 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Log files stored in \$XDG_CACHE_HOME; DATA, CONFIG, CACHE, and RUNTIME are the only directories specified by the FreeDesktop spec. - Extensions are now built with a build tool; this is an interim solution until issues with the Go plugin API are resolved. - Command line help text is cleaned up. +- Version bump of gopsutil ### Removed diff --git a/config.go b/config.go index 0cc5e61..758b8c2 100644 --- a/config.go +++ b/config.go @@ -74,7 +74,12 @@ func (conf *Config) Load() error { } var err error if _, err = os.Stat(conf.ConfigFile); os.IsNotExist(err) { - return nil + // Check for the file in the usual suspects + folder := conf.ConfigDir.QueryFolderContainsFile(conf.ConfigFile) + if folder == nil { + return nil + } + conf.ConfigFile = filepath.Join(folder.Path, conf.ConfigFile) } if in, err = ioutil.ReadFile(conf.ConfigFile); err != nil { return err diff --git a/go.mod b/go.mod index d0867eb..975ca3d 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/mitchellh/go-wordwrap v1.0.0 // indirect github.com/prometheus/client_golang v1.4.1 github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 - github.com/shirou/gopsutil v2.18.11+incompatible + github.com/shirou/gopsutil v2.20.3+incompatible github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect github.com/stretchr/testify v1.4.0 github.com/xxxserxxx/iSMC v1.0.1 diff --git a/go.sum b/go.sum index f165c4a..2e2c454 100644 --- a/go.sum +++ b/go.sum @@ -97,6 +97,8 @@ github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 h1:Xuk8ma/ibJ1 github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7AwjWCpdPhkSmNAgUv5C7EJ4AbmjEB3r047r3DXWu3Y= github.com/shirou/gopsutil v2.18.11+incompatible h1:PMFTKnFTr/YTRW5rbLK4vWALV3a+IGXse5nvhSjztmg= github.com/shirou/gopsutil v2.18.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v2.20.3+incompatible h1:0JVooMPsT7A7HqEYdydp/OfjSOYSjhXV7w1hkKj/NPQ= +github.com/shirou/gopsutil v2.20.3+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=