Don't crash if only file to open is directory

This commit is contained in:
Zachary Yedidia
2020-01-02 15:25:07 -05:00
parent 50ff45c213
commit 0bf54ff0e7
2 changed files with 9 additions and 1 deletions

View File

@@ -133,7 +133,7 @@ func NewBufferFromFile(path string, btype BufType) (*Buffer, error) {
fileInfo, _ := os.Stat(filename)
if err == nil && fileInfo.IsDir() {
return nil, errors.New(filename + " is a directory")
return nil, errors.New("Error: " + filename + " is a directory and cannot be opened")
}
defer file.Close()