mirror of
https://github.com/spf13/viper
synced 2025-05-06 12:17:18 +00:00
Delete findCWD method from util
It was unused
This commit is contained in:
parent
6953393ddd
commit
d120ea2ddb
1 changed files with 3 additions and 26 deletions
29
util.go
29
util.go
|
@ -68,10 +68,10 @@ func absPathify(inPath string) string {
|
|||
p, err := filepath.Abs(inPath)
|
||||
if err == nil {
|
||||
return filepath.Clean(p)
|
||||
} else {
|
||||
jww.ERROR.Println("Couldn't discover absolute path")
|
||||
jww.ERROR.Println(err)
|
||||
}
|
||||
|
||||
jww.ERROR.Println("Couldn't discover absolute path")
|
||||
jww.ERROR.Println(err)
|
||||
return ""
|
||||
}
|
||||
|
||||
|
@ -107,29 +107,6 @@ func userHomeDir() string {
|
|||
return os.Getenv("HOME")
|
||||
}
|
||||
|
||||
func findCWD() (string, error) {
|
||||
serverFile, err := filepath.Abs(os.Args[0])
|
||||
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Can't get absolute path for executable: %v", err)
|
||||
}
|
||||
|
||||
path := filepath.Dir(serverFile)
|
||||
realFile, err := filepath.EvalSymlinks(serverFile)
|
||||
|
||||
if err != nil {
|
||||
if _, err = os.Stat(serverFile + ".exe"); err == nil {
|
||||
realFile = filepath.Clean(serverFile + ".exe")
|
||||
}
|
||||
}
|
||||
|
||||
if err == nil && realFile != serverFile {
|
||||
path = filepath.Dir(realFile)
|
||||
}
|
||||
|
||||
return path, nil
|
||||
}
|
||||
|
||||
func unmarshallConfigReader(in io.Reader, c map[string]interface{}, configType string) error {
|
||||
buf := new(bytes.Buffer)
|
||||
buf.ReadFrom(in)
|
||||
|
|
Loading…
Add table
Reference in a new issue