mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Deleting json files if they are some how corrupted. Fixes #3015
This commit is contained in:
@ -85,7 +85,7 @@ public class FileUtils {
|
||||
recursiveDelete(current);
|
||||
}
|
||||
}
|
||||
file.delete();
|
||||
deleteIfExists(file);
|
||||
}
|
||||
|
||||
public static File createTempFolder() throws IOException {
|
||||
@ -269,5 +269,16 @@ public class FileUtils {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean deleteIfExists(File file) {
|
||||
if (file == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!file.exists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return file.delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user