Fix output directory issue

I mistake to use file name instead of directory name
Merge pull request #175 from defunkt/fix-compile-func

Fix output directory issue