public static FsPath WithName(this FsPath path, Func <string, string> transformation) { var tail = path.Basename(); string transformed = transformation(tail); if (FsPath.Comparer.Equals(tail, transformed)) { return(path); } return(path.Parent().Join(transformed)); }
public static FsPath ChangeDirectory(this FsPath path, FsPath directory) => directory.Join(path.Basename());