tools::ensureDir is now working
simplified tools::ensureDir
added tools::writeToFile