Write the .map file in the same directory as the output file.

Fixes #1538
why the toString here and below?