CB-7978 Cleaning code and creating temporary dir
- Using path.resolve and path.join instead of concatenating paths
- Fixing error when temporary dir already exists by using shelljs instead of fs