функция Path::join

Объединяет текущий и заданный относительный пути

Синтаксис

Path
Path.join
(Path further)

Передаваемые параметры

Path further

Возвращаемое значение

Path

Описание

/** * Joins the relative path [further] to this path. Canonicalizes the * resulting joined path using [canonicalize], * interpreting '.' and '..' as directory traversal commands, and removing * consecutive path separators. * * If [further] is an absolute path, an IllegalArgument exception is thrown. * * Examples: * `new Path('/a/b/c').join(new Path('d/e'))` returns the Path object * containing `'a/b/c/d/e'`. * * `new Path('a/b/../c/').join(new Path('d/./e//')` returns the Path * containing `'a/c/d/e/'`. * * `new Path('a/b/c').join(new Path('d/../../e')` returns the Path * containing `'a/b/e'`. * * Note that the join operation does not drop the last segment of the * base path, the way URL joining does. That would be accomplished with * basepath.directoryPath.join(further). * * If you want to avoid joins that traverse * parent directories in the base, you can check whether * `further.canonicalize()` starts with '../' or equals '..'. */

Официальная документация (английский)