Skip to content

Commit

Permalink
Update DNSFilterManager.java
Browse files Browse the repository at this point in the history
  • Loading branch information
IngoZenz committed Jan 17, 2024
1 parent fa9eeb7 commit dfc65cc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/dnsfilter/DNSFilterManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -620,16 +620,20 @@ public void doRestoreDefaults() throws IOException {

@Override
public void doRestore(String name) throws IOException {

try {
if (!canStop())
throw new IOException("Cannot stop! Pending operation!");

stop();
invalidate();
copyLocalFile("backup/"+name+"/dnsfilter.conf", "dnsfilter.conf");
copyLocalFile("backup/"+name+"/additionalHosts.txt", "additionalHosts.txt");
copyLocalFile("backup/"+name+"/VERSION.TXT", "VERSION.TXT");

//delete eventually existing invalid default config file.
new File(getPath() + "dnsfilter-default.conf").delete();

// copy default file from backup if existing. In case it does not exist in backup folder,
//it will be created via getConfigMergeIfNeeded!
File defaultCfg = new File(getPath() + "backup/"+name+"/dnsfilter-default.conf");

if (defaultCfg.exists())
Expand Down

0 comments on commit dfc65cc

Please sign in to comment.