Move hosts file to data folder

This commit is contained in:
M66B 2016-01-24 14:10:22 +01:00
parent 2ca17cd4a7
commit e1127183e1
2 changed files with 3 additions and 3 deletions

View File

@ -180,7 +180,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
// Handle hosts
Preference pref_hosts = screen.findPreference("hosts");
Preference pref_block_domains = screen.findPreference("use_hosts");
pref_block_domains.setEnabled(new File(getCacheDir(), "hosts.txt").exists());
pref_block_domains.setEnabled(new File(getFilesDir(), "hosts.txt").exists());
if (Util.isPlayStoreInstall(this)) {
PreferenceCategory pref_backup = (PreferenceCategory) screen.findPreference("category_backup");
@ -615,7 +615,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
new AsyncTask<Object, Object, Throwable>() {
@Override
protected Throwable doInBackground(Object... objects) {
File hosts = new File(getCacheDir(), "hosts.txt");
File hosts = new File(getFilesDir(), "hosts.txt");
FileOutputStream out = null;
InputStream in = null;

View File

@ -726,7 +726,7 @@ public class SinkholeService extends VpnService implements SharedPreferences.OnS
boolean use_hosts = prefs.getBoolean("use_hosts", false);
if (log || filter) {
int prio = Integer.parseInt(prefs.getString("loglevel", Integer.toString(Log.INFO)));
File hosts = new File(getCacheDir(), "hosts.txt");
File hosts = new File(getFilesDir(), "hosts.txt");
String hname = (use_hosts && hosts.exists() ? hosts.getAbsolutePath() : null);
jni_start(vpn.getFd(), getAllowedUids(listAllowed), hname, log, filter, prio);
}