From ba1b6c7095d9a10b63c5fff3c71cfc4d97fc4d59 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 30 Apr 2018 19:55:06 +0200 Subject: [PATCH] ZipExporterPreference: account for directory already existing Signed-off-by: Jason A. Donenfeld --- .../com/wireguard/android/preference/ZipExporterPreference.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java b/app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java index 677c56c9..b8e89985 100644 --- a/app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java +++ b/app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java @@ -76,7 +76,7 @@ public class ZipExporterPreference extends Preference { throw exception; final File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); final File file = new File(path, "wireguard-export.zip"); - if (!path.mkdirs()) + if (!path.isDirectory() && !path.mkdirs()) throw new IOException("Cannot create output directory"); try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(file))) { for (int i = 0; i < futureConfigs.size(); ++i) {