Create output directory if doesn't exist.

- move code to FilePath class
- create absolute path of output directory
- changes in unit tests