1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-20 04:31:55 +02:00

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);
if (!new File(Utils.getConfigDir()).exists()) {
logger.error("Config dir doesn't exist");
return;
logger.info("Making config dir");
boolean couldMakeDir = new File(Utils.getConfigDir()).mkdirs();
if (!couldMakeDir) {
logger.error("Couldn't make config dir");
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()) {
logger.error("Can't write to url history file: " + URLHistoryFile);
return;
}
// if file doesnt exists, then create it
if (!file.exists()) {
file.createNewFile();
}
fw = new FileWriter(file.getAbsoluteFile(), true);
bw = new BufferedWriter(fw);
bw.write(downloadedURL);