ZipExporterPreference: account for directory already existing
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
843003f436
commit
ba1b6c7095
@ -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…
Reference in New Issue
Block a user