lib: Folder marker is now a folder

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4341
LGTM: calmh
This commit is contained in:
Audrius Butkevicius
2017-09-02 05:52:38 +00:00
committed by Jakob Borg
parent 19e52a10df
commit ab132ff6fe
16 changed files with 143 additions and 79 deletions

View File

@@ -11,6 +11,7 @@ import (
"io"
"os"
"path/filepath"
"strings"
"time"
)
@@ -133,3 +134,20 @@ func NewFilesystem(fsType FilesystemType, uri string) Filesystem {
}
return fs
}
// IsInternal returns true if the file, as a path relative to the folder
// root, represents an internal file that should always be ignored. The file
// path must be clean (i.e., in canonical shortest form).
func IsInternal(file string) bool {
internals := []string{".stfolder", ".stignore", ".stversions"}
pathSep := string(PathSeparator)
for _, internal := range internals {
if file == internal {
return true
}
if strings.HasPrefix(file, internal+pathSep) {
return true
}
}
return false
}