Standard Path Operations
Comparison and queryoperations as well as making new paths relative to a base path
Relative Paths
Create new paths relative to another path
import scalax.file.Path
val path: Path = Path("file")
// if path is a directory then you can use the \
// methods to make a new path based on that directory
val child1: Path = path \ "childFile"
val child3: Path = path \ "dir1" \ "f3"
val child4: Path = path \ Path("f4")
val child5: Path = path \ Path("dir2") \ Path("f5")
val child6: Path = path / Path("dir2", "f5")
val child7: Path = path / "dir2" / "f5"
// if on windows
val child8: Path = Path("c:") / "dir2" / "f5"
val child9: Path = Path("c:") \ "dir2" \ "f5"
val child10: Path = Path("c:", "dir2", "f5")
// the resolve methods is essentially an alias for \ for those
// who are uncomfortable with operator type methods. Also to
// maintain a familiar feel with NIO Path
val child11: Path = path.resolve("child")
val child12: Path = path.resolve(Path("child", "grandchild"))
// make a Path relative to another path
// This should result in path "child"
val relative: Path = path.relativize(Path("file", "child"))
// Parent paths and root of the current path
val parent: Option[Path] = path.parent
val parents: List[Path] = path.parents
val root: Option[Path] = path.root