github.com/mutagen-io/mutagen@v0.18.0-rc1/pkg/filesystem/visibility_posix.go (about) 1 //go:build !windows 2 3 package filesystem 4 5 import ( 6 "errors" 7 "path/filepath" 8 "strings" 9 ) 10 11 // MarkHidden ensures that a path is hidden. 12 func MarkHidden(path string) error { 13 // POSIX platforms don't have the notion of a hidden attribute, they only 14 // hide dot-prefixed paths, so ensure that the path begins with a dot. 15 if strings.IndexByte(filepath.Base(path), '.') != 0 { 16 return errors.New("only dot-prefixed files are hidden on POSIX") 17 } 18 19 // Success. 20 return nil 21 }