Ignore empty filename on macOS.

This commit is contained in:
Nuno Cruces 2021-02-18 13:24:02 +00:00
parent 0e4174d92c
commit dc342bfc5a
2 changed files with 16 additions and 16 deletions

View file

@ -85,10 +85,12 @@ func (f FileFilters) apply(o *options) {
}
func splitDirAndName(path string) (dir, name string) {
if path != "" {
path = filepath.Clean(path)
fi, err := os.Stat(path)
if err == nil && fi.IsDir() {
return path, ""
}
}
return filepath.Split(path)
}

View file

@ -359,7 +359,6 @@ func browseForFolder(opts options) (string, []string, error) {
}
func initDirNameExt(filename string, name []uint16) (dir *uint16, ext *uint16) {
if filename != "" {
d, n := splitDirAndName(filename)
e := filepath.Ext(n)
if n != "" {
@ -371,7 +370,6 @@ func initDirNameExt(filename string, name []uint16) (dir *uint16, ext *uint16) {
if e != "" {
ext = syscall.StringToUTF16Ptr(e[1:])
}
}
return
}