You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
385 B
23 lines
385 B
4 years ago
|
package utils
|
||
|
|
||
|
import "os"
|
||
|
|
||
|
// Determine whether the given path is a folder
|
||
|
func IsDir(path string) bool {
|
||
|
s, err := os.Stat(path)
|
||
|
if err != nil {
|
||
|
return false
|
||
|
}
|
||
|
return s.IsDir()
|
||
|
}
|
||
|
|
||
|
// Determine whether the given path is a file
|
||
|
func IsFile(path string) bool {
|
||
|
return !IsDir(path)
|
||
|
}
|
||
|
|
||
|
// Create a directory
|
||
|
func MkDir(path string) error {
|
||
|
return os.MkdirAll(path, os.ModePerm)
|
||
|
}
|