(Ignore trailing slash when creating the temporary directory) (cherry picked from commit 40f26cb260)
40f26cb260