Update to newest pkglib
This commit is contained in:
parent
1bdcb6e3b4
commit
7ff2ecf7fe
11 changed files with 95 additions and 41 deletions
|
|
@ -9,7 +9,11 @@ func ValidateFile(path *string, dflt string) error {
|
|||
if *path == "" {
|
||||
*path = dflt
|
||||
}
|
||||
if !fsx.IsRegular(*path) {
|
||||
isFile, err := fsx.IsRegular(*path, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !isFile {
|
||||
return errors.Errorf("%q does not exist or is not a file", *path)
|
||||
}
|
||||
return nil
|
||||
|
|
@ -19,7 +23,11 @@ func ValidateDirectory(path *string, dflt string) error {
|
|||
if *path == "" {
|
||||
*path = dflt
|
||||
}
|
||||
if !fsx.IsDirectory(*path) {
|
||||
isDirectory, err := fsx.IsDirectory(*path, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !isDirectory {
|
||||
return errors.Errorf("%q does not exist or is not a directory", *path)
|
||||
}
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue