Path.withName
Returns a new Path with the file name replaced.
Parameters
newName | The new file or directory name. |
Returns
A new Path with the name replaced.
Throws
Exception if newName is empty, contains a path separator,
or this path has no name component (e.g. `.` or `/`).