diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-04-30 19:55:06 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-04-30 19:55:06 +0200 |
commit | ba1b6c7095d9a10b63c5fff3c71cfc4d97fc4d59 (patch) | |
tree | 17fe62837c6054295bf64058c82254e09f4c706d /app/src | |
parent | 843003f436846d6bfe0b7832d391043cca3579f2 (diff) |
ZipExporterPreference: account for directory already existing
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/com/wireguard/android/preference/ZipExporterPreference.java | 2 |
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) { |