Ripme now makes config dir and url_history file if they do not exist

This commit is contained in:
cyian-1756 2018-05-25 01:14:39 -04:00
parent 2977075a4b
commit ef1cab60e1

View File

@ -74,16 +74,25 @@ public abstract class AbstractRipper
File file = new File(URLHistoryFile); File file = new File(URLHistoryFile);
if (!new File(Utils.getConfigDir()).exists()) { if (!new File(Utils.getConfigDir()).exists()) {
logger.error("Config dir doesn't exist"); logger.error("Config dir doesn't exist");
logger.info("Making config dir");
boolean couldMakeDir = new File(Utils.getConfigDir()).mkdirs();
if (!couldMakeDir) {
logger.error("Couldn't make config dir");
return; return;
} }
}
// if file doesnt exists, then create it
if (!file.exists()) {
boolean couldMakeDir = file.createNewFile();
if (!couldMakeDir) {
logger.error("Couldn't url history file");
return;
}
}
if (!file.canWrite()) { if (!file.canWrite()) {
logger.error("Can't write to url history file: " + URLHistoryFile); logger.error("Can't write to url history file: " + URLHistoryFile);
return; return;
} }
// if file doesnt exists, then create it
if (!file.exists()) {
file.createNewFile();
}
fw = new FileWriter(file.getAbsoluteFile(), true); fw = new FileWriter(file.getAbsoluteFile(), true);
bw = new BufferedWriter(fw); bw = new BufferedWriter(fw);
bw.write(downloadedURL); bw.write(downloadedURL);