Add safe directory/file operations library

Closes: #5