For better error recovery, check if the directory exists before using it for localization.
We saw the following localization failure happened due to existing cache directories.
The real cause for this failure may be disk failure, LevelDB operation failure for startResourceLocalization/finishResourceLocalization or others.
I wonder whether we can add error recovery code to avoid the localization failure by not using the existing cache directories for localization.
The exception happened at files.rename(dst_work, destDirPath, Rename.OVERWRITE) in FSDownload#call. Based on the following code, after the exception, the existing cache directory used by LocalizedResource will be deleted.
Since the conflicting local directory will be deleted after localization failure,
I think it will be better to check if the directory exists before using it for localization to avoid the localization failure.