Skip to content

Commit

Permalink
fixing #18
Browse files Browse the repository at this point in the history
  • Loading branch information
will-rowe committed Apr 23, 2020
1 parent 2028f17 commit f507df4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 0 additions & 7 deletions cmd/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,6 @@ func indexParamCheck() error {

// check accessibility
misc.ErrorCheck(misc.CheckFile(msa))
if fh, err := os.Stat(*msaDir); err != nil {
return err

// skip empty files
} else if fh.Size() == 0 {
continue
}

// add to the pile
msaList = append(msaList, msa)
Expand Down
6 changes: 5 additions & 1 deletion src/misc/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,16 @@ func CheckDir(dir string) error {

// CheckFile is a function to check that a file can be read
func CheckFile(file string) error {
if _, err := os.Stat(file); err != nil {
fi, err := os.Stat(file)
if err != nil {
if os.IsNotExist(err) {
return fmt.Errorf("file does not exist: %v", file)
}
return fmt.Errorf("can't access file (check permissions): %v", file)
}
if fi.Size() == 0 {
return fmt.Errorf("file appears to be empty: %v", file)
}
return nil
}

Expand Down

0 comments on commit f507df4

Please sign in to comment.