RelativeGlob

sealed trait RelativeGlob extends Glob

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
trait Glob
class Object
trait Matchable
class Any
object AnyPath.type
object RecursiveGlob.type

Value members

Concrete methods

def /(relativeGlob: String): RelativeGlob

Appends additional components to this RelativeGlob:

Appends additional components to this RelativeGlob:

 val glob = Glob("foo/bar")
 val scalaSources = glob / "**<code>/</code>*.scala"
 scalaSources.matches(Paths.get("foo/bar/Foo.scala")) // true
 scalaSources.matches(Paths.get("foo/bar/baz/fizz/buzz/Bar.scala")) // true
 scalaSources.matches(Paths.get("foo/bar/baz/fizz/buzz/Baz.java")) // false
Value parameters:
relativeGlob

the additional query string to parse and append

Returns:

a Glob with the new RelativeGlob appended to the query.

def /(relativeGlob: RelativeGlob): RelativeGlob

Appends an additional RelativeGlob to this RelativeGlob:

Appends an additional RelativeGlob to this RelativeGlob:

 val glob = Glob("foo/bar")
 val scalaSources = glob / ** / "*.scala"
 scalaSources.matches(Paths.get("foo/bar/Foo.scala")) // true
 scalaSources.matches(Paths.get("foo/bar/baz/fizz/buzz/Bar.scala")) // true
 scalaSources.matches(Paths.get("foo/bar/baz/fizz/buzz/Baz.java")) // false
Value parameters:
relativeGlob

the additional query string to parse and append

Returns:

a Glob with the new RelativeGlob appended to the query.

def /(regex: Regex): RelativeGlob

Appends a relative glob specified by a regex pattern to an existing Glob. For example:

Appends a relative glob specified by a regex pattern to an existing Glob. For example:

 val glob = Glob("foo/bar")
 val scalaSources = glob / "^[^.].*\\.scala".r
 scalaSources.matches(Paths.get("foo/bar/Foo.scala")) // true
 scalaSources.matches(Paths.get("foo/bar/.hidden.scala")) // false

Note that it is not possible to specify a recursive glob this way because ** is not valid in regex. To make a recursive glob, combine with RecursiveGlob:

 val scalaSources = Glob("foo/bar") / ** / "^[^.].*\\.scala".r
 scalaSources.matches(Paths.get("foo/bar/baz/fizz/buzz/Foo.scala")) // true
 scalaSources.matches(Paths.get("foo/bar/baz/fizz/buzz/.hidden.scala")) // false

On Windows, \ will be treated as a regex escape character but / will be treated as a path separator.

Value parameters:
regex

the pattern to apply

Returns:

a Glob with the new RelativeGlob appended to the query.

Inherited methods

def matches(path: Path): Boolean

Indicates whether a path matches the pattern specified by this Glob.

Indicates whether a path matches the pattern specified by this Glob.

Value parameters:
path

the path to match

Returns:

true it the path matches.

Inherited from:
Glob