Add buildPath() function.