Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import com.owncloud.android.utils.theme.ViewThemeUtils;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;

import androidx.appcompat.app.AlertDialog;
import androidx.core.content.res.ResourcesCompat;
Expand Down Expand Up @@ -364,10 +366,19 @@ protected Integer doInBackground(Void... args) {
try {
File dstFile = new File(mStorageTarget + File.separator + MainApp.getDataFolder());
deleteRecursive(dstFile);
dstFile.delete();
try {
Files.delete(dstFile.toPath());
} catch (IOException e) {
Log_OC.e(TAG, "Could not delete destination file: " + dstFile.getAbsolutePath(), e);
}

File srcFile = new File(mStorageSource + File.separator + MainApp.getDataFolder());
srcFile.mkdirs();

try {
Files.createDirectories(srcFile.toPath());
} catch (IOException e) {
Log_OC.e(TAG, "Could not create directory: " + srcFile.getAbsolutePath(), e);
}

publishProgress(R.string.file_migration_checking_destination);

Expand Down Expand Up @@ -466,7 +477,11 @@ private void cleanup() {
if (!deleteRecursive(srcFile)) {
Log_OC.w(TAG, "Migration cleanup step failed");
}
srcFile.delete();
try {
Files.delete(srcFile.toPath());
} catch (IOException e) {
Log_OC.e(TAG, "Could not delete source file: " + srcFile.getAbsolutePath(), e);
}
}

private boolean deleteRecursive(File f) {
Expand Down
Loading