Add support output directory for result
This patch create the real option of specifying output directory
for output files creation. By the default, it uses the workdir if
the option is not specified and workdir is available. It uses
current directory if workdir is unavailable.
Fixes #296