aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/org/pacien/tincapp/context/StorageMigrator.kt9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/context/StorageMigrator.kt b/app/src/main/java/org/pacien/tincapp/context/StorageMigrator.kt
index 6bde2f6..b920522 100644
--- a/app/src/main/java/org/pacien/tincapp/context/StorageMigrator.kt
+++ b/app/src/main/java/org/pacien/tincapp/context/StorageMigrator.kt
@@ -1,6 +1,6 @@
1/* 1/*
2 * Tinc Mesh VPN: Android client and user interface 2 * Tinc Mesh VPN: Android client and user interface
3 * Copyright (C) 2017-2023 Euxane P. TRAN-GIRARD 3 * Copyright (C) 2017-2024 Euxane P. TRAN-GIRARD
4 * 4 *
5 * This program is free software: you can redistribute it and/or modify 5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
@@ -40,11 +40,12 @@ class StorageMigrator {
40 } 40 }
41 41
42 private fun migrateConfigurationDirectory() { 42 private fun migrateConfigurationDirectory() {
43 val oldConfigDir = context.getExternalFilesDir(null) 43 val externalStorageDir = context.getExternalFilesDir(null) ?: return
44 if (oldConfigDir == null || oldConfigDir.listFiles().isNullOrEmpty()) return // nothing to do 44 val oldConfigDir = File(externalStorageDir, "networks")
45 if (!oldConfigDir.exists()) return
45 46
46 try { 47 try {
47 val newConfigDir = context.filesDir 48 val newConfigDir = AppPaths.confDir()
48 log.info( 49 log.info(
49 "Migrating files present in old configuration directory at {} to {}", 50 "Migrating files present in old configuration directory at {} to {}",
50 oldConfigDir.absolutePath, 51 oldConfigDir.absolutePath,