Now checks that URLHistory exists and that we can write to it before trying to write to it

This commit is contained in:
cyian-1756 2018-05-24 13:43:54 -04:00
parent d11dfe814b
commit 2977075a4b

View File

@ -72,6 +72,14 @@ public abstract class AbstractRipper
FileWriter fw = null; FileWriter fw = null;
try { try {
File file = new File(URLHistoryFile); File file = new File(URLHistoryFile);
if (!new File(Utils.getConfigDir()).exists()) {
logger.error("Config dir doesn't exist");
return;
}
if (!file.canWrite()) {
logger.error("Can't write to url history file: " + URLHistoryFile);
return;
}
// if file doesnt exists, then create it // if file doesnt exists, then create it
if (!file.exists()) { if (!file.exists()) {
file.createNewFile(); file.createNewFile();