Safer handling of temporary directories.