Ensure directory is writable before using it.