Add missing watch event for files
If a file was supposed to exist in a directory, and it didn't exist yet, when it gets created, we should notice, and cause an event so that we wake up and actually see about then creating that file!
This commit is contained in:
11
misc.go
11
misc.go
@@ -52,6 +52,17 @@ func HasPathPrefix(p, prefix string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Delta of path prefix, tells you how many path tokens different the prefix is
|
||||
func PathPrefixDelta(p, prefix string) int {
|
||||
|
||||
if !HasPathPrefix(p, prefix) {
|
||||
return -1
|
||||
}
|
||||
patharray := PathSplit(p)
|
||||
prefixarray := PathSplit(prefix)
|
||||
return len(patharray) - len(prefixarray)
|
||||
}
|
||||
|
||||
func PathIsDir(p string) bool {
|
||||
return p[len(p)-1:] == "/" // a dir has a trailing slash in this context
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user