From d00b437295dfdabcc17db6004c7a153f2ecf2a51 Mon Sep 17 00:00:00 2001 From: asoseil Date: Sun, 22 Oct 2017 19:22:07 +0200 Subject: [PATCH] wdir method moved to utils --- settings.go | 7 ------- utils.go | 10 ++++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/settings.go b/settings.go index 2301e22..7b1af07 100644 --- a/settings.go +++ b/settings.go @@ -76,13 +76,6 @@ func random(n int) string { return string(b) } -// Wdir return the current working directory -func (s Settings) wdir() string { - dir, err := os.Getwd() - s.validate(err) - return filepath.Base(dir) -} - // Flimit defines the max number of watched files func (s *Settings) flimit() error { var rLimit syscall.Rlimit diff --git a/utils.go b/utils.go index 4025f79..79c94d8 100644 --- a/utils.go +++ b/utils.go @@ -6,6 +6,7 @@ import ( "os" "path/filepath" "strings" + "log" ) // getEnvPath returns the first path found in env or empty string @@ -83,3 +84,12 @@ func replace(a []string, b string) []string { } return a } + +// Wdir return current working directory +func wdir() string { + dir, err := os.Getwd() + if err != nil { + log.Fatal(prefix(err.Error())) + } + return dir +}