Attempt to fix bootstrap installation failure that may be caused by invalid mkdirs return value

This commit is contained in:
agnostic-apollo
2021-07-08 10:50:30 +05:00
parent c6b4114f86
commit dc8bdfe675

View File

@@ -326,9 +326,10 @@ public class FileUtils {
if (createDirectoryIfMissing && fileType == FileType.NO_EXIST) {
Logger.logVerbose(LOG_TAG, "Creating " + label + "directory file at path \"" + filePath + "\"");
// Create directory and update fileType if successful, otherwise return with error
if (file.mkdirs())
fileType = getFileType(filePath, false);
else
// It "might" be possible that mkdirs returns false even though directory was created
boolean result = file.mkdirs();
fileType = getFileType(filePath, false);
if (!result && fileType != FileType.DIRECTORY)
return FileUtilsErrno.ERRNO_CREATING_FILE_FAILED.getError(label + "directory file", filePath);
}