summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-04-30 19:55:06 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-04-30 19:55:06 +0200
commitba1b6c7095d9a10b63c5fff3c71cfc4d97fc4d59 (patch)
tree17fe62837c6054295bf64058c82254e09f4c706d
parent843003f436846d6bfe0b7832d391043cca3579f2 (diff)
ZipExporterPreference: account for directory already existing
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java2
1 files changed, 1 insertions, 1 deletions
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) {