Using Paths
Catscript is implemented with fs2-io, and one of the abstraction it provides is Path. It represents a path to a file or a directory.
You can start using Path's by importing the type from the library:
import fs2.io.file.Path
Creating a Path
The recommended way for creating a Path is using the apply method of the companion object:
val path = Path("path/to/a/file/or/directory")
// path: Path = path/to/a/file/or/directory
Once you did that, you can combine paths using some convenience methods:
val parent = Path("parent/dir")
// parent: Path = parent/dir
val child = Path("child/dir")
// child: Path = child/dir
parent / child / "some/more/locations"
// res0: Path = parent/dir/child/dir/some/more/locations
Note that these paths are compatible with the Java NIO paths, so you can use them interchangeably by calling the toNioPath value.