Added Utils.getURLHistoryFile() func to get the URL history file path, clearing history now deletes url history file

This commit is contained in:
cyian-1756 2017-11-07 04:49:39 -05:00
parent 169547d745
commit 9898c149e1
3 changed files with 12 additions and 2 deletions

View File

@ -28,7 +28,7 @@ public abstract class AbstractRipper
implements RipperInterface, Runnable {
protected static final Logger logger = Logger.getLogger(AbstractRipper.class);
private final String URLHistoryFile = Utils.getConfigDir() + File.separator + "url_history.txt";
private final String URLHistoryFile = Utils.getURLHistoryFile();
public static final String USER_AGENT =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:36.0) Gecko/20100101 Firefox/36.0";

View File

@ -665,6 +665,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
saveHistory();
});
historyButtonClear.addActionListener(event -> {
Utils.clearURLHistory();
HISTORY.clear();
try {
historyTableModel.fireTableDataChanged();

View File

@ -20,7 +20,6 @@ import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.Line;
import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
@ -176,6 +175,16 @@ public class Utils {
return ".";
}
}
// Delete the url history file
public static void clearURLHistory() {
File file = new File(getURLHistoryFile());
file.delete();
}
// Return the path of the url history file
public static String getURLHistoryFile() {
return getConfigDir() + File.separator + "url_history.txt";
}
private static String getConfigFilePath() {
return getConfigDir() + File.separator + configFile;