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 { implements RipperInterface, Runnable {
protected static final Logger logger = Logger.getLogger(AbstractRipper.class); 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 = public static final String USER_AGENT =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:36.0) Gecko/20100101 Firefox/36.0"; "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(); saveHistory();
}); });
historyButtonClear.addActionListener(event -> { historyButtonClear.addActionListener(event -> {
Utils.clearURLHistory();
HISTORY.clear(); HISTORY.clear();
try { try {
historyTableModel.fireTableDataChanged(); historyTableModel.fireTableDataChanged();

View File

@ -20,7 +20,6 @@ import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip; import javax.sound.sampled.Clip;
import javax.sound.sampled.Line; import javax.sound.sampled.Line;
import javax.sound.sampled.LineEvent; import javax.sound.sampled.LineEvent;
import javax.sound.sampled.LineListener;
import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.configuration.PropertiesConfiguration;
@ -176,6 +175,16 @@ public class Utils {
return "."; 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() { private static String getConfigFilePath() {
return getConfigDir() + File.separator + configFile; return getConfigDir() + File.separator + configFile;