From b2b22fb67459127b4b652447c3c8c6946c3d4fca Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Sun, 31 Mar 2019 23:39:41 +0300 Subject: [PATCH] disable hidden on windows --- nav.go | 6 +++--- os.go | 4 ++++ os_windows.go | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/nav.go b/nav.go index 39efa075..4f480ff5 100644 --- a/nav.go +++ b/nav.go @@ -144,13 +144,13 @@ func (dir *dir) sort() { // files to the first non-hidden file in the list if gOpts.sortType.option&hiddenSort == 0 { sort.SliceStable(dir.files, func(i, j int) bool { - if dir.files[i].Name()[0] == '.' && dir.files[j].Name()[0] == '.' { + if isHidden(dir.files[i]) && isHidden(dir.files[j]) { return i < j } - return dir.files[i].Name()[0] == '.' + return isHidden(dir.files[i]) }) for i, f := range dir.files { - if f.Name()[0] != '.' { + if isHidden(f) { dir.files = dir.files[i:] return } diff --git a/os.go b/os.go index 3117bb8a..1a268575 100644 --- a/os.go +++ b/os.go @@ -133,6 +133,10 @@ func isExecutable(f os.FileInfo) bool { return f.Mode()&0111 != 0 } +func isHidden(f os.FileInfo) bool { + return f.Name()[0] == '.' +} + func exportFiles(f string, fs []string) { envFile := f envFiles := strings.Join(fs, gOpts.filesep) diff --git a/os_windows.go b/os_windows.go index 429c3a8a..dd86e2b0 100644 --- a/os_windows.go +++ b/os_windows.go @@ -116,6 +116,11 @@ func isExecutable(f os.FileInfo) bool { return false } +func isHidden(f os.FileInfo) bool { + // TODO: implement + return false +} + func exportFiles(f string, fs []string) { envFile := fmt.Sprintf(`"%s"`, f)