Ignore empty filename on macOS.
This commit is contained in:
parent
0e4174d92c
commit
dc342bfc5a
2 changed files with 16 additions and 16 deletions
10
file.go
10
file.go
|
@ -85,10 +85,12 @@ func (f FileFilters) apply(o *options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func splitDirAndName(path string) (dir, name string) {
|
func splitDirAndName(path string) (dir, name string) {
|
||||||
path = filepath.Clean(path)
|
if path != "" {
|
||||||
fi, err := os.Stat(path)
|
path = filepath.Clean(path)
|
||||||
if err == nil && fi.IsDir() {
|
fi, err := os.Stat(path)
|
||||||
return path, ""
|
if err == nil && fi.IsDir() {
|
||||||
|
return path, ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return filepath.Split(path)
|
return filepath.Split(path)
|
||||||
}
|
}
|
||||||
|
|
|
@ -359,18 +359,16 @@ func browseForFolder(opts options) (string, []string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func initDirNameExt(filename string, name []uint16) (dir *uint16, ext *uint16) {
|
func initDirNameExt(filename string, name []uint16) (dir *uint16, ext *uint16) {
|
||||||
if filename != "" {
|
d, n := splitDirAndName(filename)
|
||||||
d, n := splitDirAndName(filename)
|
e := filepath.Ext(n)
|
||||||
e := filepath.Ext(n)
|
if n != "" {
|
||||||
if n != "" {
|
copy(name, syscall.StringToUTF16(n))
|
||||||
copy(name, syscall.StringToUTF16(n))
|
}
|
||||||
}
|
if d != "" {
|
||||||
if d != "" {
|
dir = syscall.StringToUTF16Ptr(d)
|
||||||
dir = syscall.StringToUTF16Ptr(d)
|
}
|
||||||
}
|
if e != "" {
|
||||||
if e != "" {
|
ext = syscall.StringToUTF16Ptr(e[1:])
|
||||||
ext = syscall.StringToUTF16Ptr(e[1:])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue