Improve tmp dir handling
Add test for getDestFileName and fix argument