ProfileService: Only load from files ending with .conf

This condition was previously enforced in the AsyncTask, but was lost in
the move from ProfileListActivity to ProfileService.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Samuel Holland 2017-07-30 02:18:17 -05:00
parent c65ac9fafe
commit d8a5ec3f19

View File

@ -12,6 +12,7 @@ import android.util.Log;
import com.wireguard.config.Profile; import com.wireguard.config.Profile;
import java.io.File; import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -33,7 +34,12 @@ public class ProfileService extends Service {
@Override @Override
public void onCreate() { public void onCreate() {
new ProfileLoader().execute(getFilesDir().listFiles()); new ProfileLoader().execute(getFilesDir().listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".conf");
}
}));
} }
@Override @Override