The OBJ writer had two bugs: regardless of the target dir, it wrote the mtl file to the current dir, and it used the mesh's original name, not the new name.
Examples for each:
1) You are in /some/random/dir. You tell irr to write to /tmp/dest.obj. The mtl file goes to the current dir still, I expect it to go next to the obj file.
2) Say you load orig.ply and write to newfile.obj. The mtl file is not named newfile.mtl, but orig.mtl.
This patch fixes both.