Skip to content

Commit 433f268

Browse files
committed
internal: add osutil as internal package to drop dependency on mewkiz/pkg
Code from mewkiz/pkg@518ade7.
1 parent 5aaf037 commit 433f268

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

internal/osutil/osutil.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Package osutil implements OS utility functions.
2+
package osutil
3+
4+
import (
5+
"log"
6+
"os"
7+
)
8+
9+
// Exists reports whether the given file or directory exists.
10+
func Exists(path string) bool {
11+
_, err := os.Stat(path)
12+
if err == nil {
13+
return true
14+
}
15+
if os.IsNotExist(err) {
16+
return false
17+
}
18+
log.Printf("unable to stat path %q; %v", path, err)
19+
return false
20+
}

0 commit comments

Comments
 (0)