1
0
mirror of https://github.com/rclone/rclone.git synced 2025-03-17 20:27:52 +02:00
2018-01-16 13:20:59 +00:00

18 lines
364 B
Go

package check
import (
"fmt"
"os"
)
// Dir checks the given path, will return error if path not exists or path
// is not directory.
func Dir(path string) error {
if info, err := os.Stat(path); err != nil {
return fmt.Errorf(`directory not exists: %s`, path)
} else if !info.IsDir() {
return fmt.Errorf(`path is not directory: %s`, path)
}
return nil
}