From 71ce7f35b541187b58e52f0713e2c19bcf8f6c7b Mon Sep 17 00:00:00 2001 From: crusader Date: Thu, 21 Sep 2017 10:22:15 +0900 Subject: [PATCH] ing --- config.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/config.go b/config.go index 58de2ee..6ef8200 100644 --- a/config.go +++ b/config.go @@ -91,7 +91,13 @@ func Save(target interface{}, file string, overWrite bool) error { return _c.Save(target, file, overWrite) } func (c *config) Save(target interface{}, file string, overWrite bool) error { - return marshalFile(target, file, overWrite) + var absPath string + var err error + if absPath, err = absPathify(file); nil != err { + return err + } + + return marshalFile(target, absPath, overWrite) } // 1. file @@ -101,8 +107,10 @@ func (c *config) getConfigFiles(files ...string) []string { for _, file := range files { // check configuration - if exists(file) { - results = append(results, file) + if absin, err := absPathify(file); nil == err { + if exists(absin) { + results = append(results, absin) + } } }