Browse Source

ZipExporterPreference: account for directory already existing

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
master
Jason A. Donenfeld 6 years ago
parent
commit
ba1b6c7095
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java

+ 1
- 1
app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java View File

@@ -76,7 +76,7 @@ public class ZipExporterPreference extends Preference {
throw exception; throw exception;
final File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); final File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
final File file = new File(path, "wireguard-export.zip"); final File file = new File(path, "wireguard-export.zip");
if (!path.mkdirs())
if (!path.isDirectory() && !path.mkdirs())
throw new IOException("Cannot create output directory"); throw new IOException("Cannot create output directory");
try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(file))) { try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(file))) {
for (int i = 0; i < futureConfigs.size(); ++i) { for (int i = 0; i < futureConfigs.size(); ++i) {


Loading…
Cancel
Save