sbt.nio.file
Type members
Classlikes
A RelativeGlob that matches any single path name.
A RelativeGlob that matches any single path name.
AnyPath.matches(Paths.get("foo")) // true
AnyPath.matches(Paths.get("foo/bar")) // false
Glob("foo/bar", AnyPath).matches(Paths.get("foo/bar")) // false
Glob("foo/bar", AnyPath).matches(Paths.get("foo/bar/baz")) // true
Glob("foo/bar", AnyPath).matches(Paths.get("foo/bar/baz/buzz")) // false
It can be used to specify the minimum depth of a query:
val childScalaSources = Glob("/foo/bar") / AnyPath / RecursiveGlob / "*.scala"
childScalaSources.matches(Paths.get("/foo/bar/Foo.scala")) // false
childScalaSources.matches(Paths.get("/foo/bar/baz/Bar.scala")) // true
childScalaSources.matches(Paths.get("/foo/bar/baz/fizz/buzz/Bar.scala")) // true
Represents a set of possible file changes.
Represents a set of possible file changes.
- Value parameters:
- created
the files that are newly created
- deleted
the files that have been deleted
- updated
the files that have been updated
Represents a minimal set of attributes a file. In contrast to
java.nio.file.attribute.BasicFileAttributes
, it is possible to compute the values provided
by this trait without stating the file. If all of the methods return false, the user may infer
that the file to which these attributes corresponds does not exist. An instance of this class
may not represent that current state of the file if the underlying file has been modified since
the instance was first created.
Represents a minimal set of attributes a file. In contrast to
java.nio.file.attribute.BasicFileAttributes
, it is possible to compute the values provided
by this trait without stating the file. If all of the methods return false, the user may infer
that the file to which these attributes corresponds does not exist. An instance of this class
may not represent that current state of the file if the underlying file has been modified since
the instance was first created.
- Companion:
- object
Provides a view into the file system that allows retrieval of the children of a particular path. Specific implementations may use native library on some platforms to speed up recursive file tree traversal.
Provides a view into the file system that allows retrieval of the children of a particular path. Specific implementations may use native library on some platforms to speed up recursive file tree traversal.
- Type parameters:
- T
the type of object returned for each file
- Companion:
- object
Represents a query for a path on the file system. Instances of Glob
can be combined together
to build a more complicated query. Similar to the path name components of a Path
, a Glob
has
components and matching is done from left to right component-wise. Each component is matched
using a
https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileSystem.html#getPathMatcher-java.lang.String-
PathMatcher.
For example,
Represents a query for a path on the file system. Instances of Glob
can be combined together
to build a more complicated query. Similar to the path name components of a Path
, a Glob
has
components and matching is done from left to right component-wise. Each component is matched
using a
https://docs.oracle.com/javase/8/docs/api/java/nio/file/FileSystem.html#getPathMatcher-java.lang.String-
PathMatcher.
For example,
val baseGlob = Glob("/foo/bar")
baseGlob.matches(Paths.get("/foo/bar")) // true
baseGlob.matches(Paths.get("/foo")) // false
baseGlob.matches(Paths.get("/foo/bar/baz")) // false
val children = baseGlob / AnyPath
children.matches(Paths.get("/foo/bar")) // false
children.matches(Paths.get("/foo/bar/baz")) // true
children.matches(Paths.get("/foo/bar/baz/buzz")) false
val secondGenerationChildren = children / AnyPath
secondGeneration.matches(Paths.get("/foo/bar/baz")) // false
secondGeneration.matches(Paths.get("/foo/bar/baz/buzz")) // true
secondGeneration.matches(Paths.get("/foo/bar/baz/buzz/fizz")) // false
where AnyPath matches any path name.
Globs can be recursive and are constructed using the RecursiveGlob:
val baseGlob = Glob("/foo/bar")
val allDescendants = baseGlob / RecursiveGlob
allDescendants.matches(Paths.get("/foo/bar")) // false
allDescendants.matches(Paths.get("/foo/bar/baz/buzz.txt")) // true
They can also filter on the basis file names:
val baseGlob = Glob("/foo/bar")
val allScalaSources = baseGlob / RecursiveGlob / "*.scala"
allScalaSources.matches(Paths.get("/foo/bar/Foo.scala")) // true
allScalaSources.matches(Paths.get("/foo/bar/baz/fizz/buzz/Bar.scala")) // true
allScalaSources.matches(Paths.get("/foo/bar/baz/fizz/buzz/Buzz.java")) // false
val allScalaAndJavaSources = baseGlob / RecursiveGlob / "*.{java,scala}"
allScalaAndJavaSources.matches(Paths.get("/foo/bar/baz/fizz/buzz/Bar.scala")) // true
allScalaAndJavaSources.matches(Paths.get("/foo/bar/baz/fizz/buzz/Buzz.java")) // true
- Companion:
- object
A filter for a path and its attributes.
A filter for a path and its attributes.
- Companion:
- object
A RelativeGlob that matches any path. Can be combined with other Glob instances to build recursive queries:
A RelativeGlob that matches any path. Can be combined with other Glob instances to build recursive queries:
val scalaSources = Glob("/foo/bar") / RecursiveGlob / "*.scala"
scalaSources.matches(Paths.get("/foo/bar/Foo.scala")) // true
scalaSources.matches(Paths.get("/foo/bar/baz/fizz/buzz/Bar.scala")) // true
A specialization of Glob that applies only to relative paths. RelativeGlob instances
can always be combined with the /
operator whereas general Glob
instances cannot because they
may correspond to an absolute file path:
A specialization of Glob that applies only to relative paths. RelativeGlob instances
can always be combined with the /
operator whereas general Glob
instances cannot because they
may correspond to an absolute file path:
val combined = Glob("/foo/bar") / RelativeGlob("
- Companion:
- object