Fix #2300: deal with the case where there are no writable directories.