api/pkg/path/helpers.go
Peter Kurfer 0ed90708d8
Allow plugins to be resided in subdirectories
- clean output after running tests
- add formatting to make chain
2020-04-01 15:05:44 +02:00

27 lines
423 B
Go

package path
import (
"os"
"path/filepath"
)
func WorkingDirectory() (cwd string) {
cwd, _ = filepath.Abs(filepath.Dir(os.Args[0]))
return
}
func FileExists(filename string) bool {
info, err := os.Stat(filename)
if os.IsNotExist(err) {
return false
}
return !info.IsDir()
}
func DirExists(dirPath string) bool {
info, err := os.Stat(dirPath)
if os.IsNotExist(err) {
return false
}
return info.IsDir()
}