wdir method moved to utils

This commit is contained in:
asoseil 2017-10-22 19:22:07 +02:00
parent b972d0df04
commit d00b437295
2 changed files with 10 additions and 7 deletions

View File

@ -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

View File

@ -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
}