Skip to content

Commit 83acc39

Browse files
committed
fix: keep the file if copied/moved to the original destination (#38)
1 parent bec1192 commit 83acc39

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

app/src/main/java/com/raival/compose/file/explorer/screen/main/tab/regular/task/RegularTabCopyTask.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class RegularTabCopyTask(
8080
)
8181

8282
if (existingFile isNot null) {
83-
if (!existingFile!!.delete()) {
83+
if (existingFile!!.getParent()?.getPath() == to.getPath() || !existingFile.delete()) {
8484
skipped++
8585
return
8686
}
@@ -130,6 +130,7 @@ class RegularTabCopyTask(
130130
skipped++
131131
}
132132
}
133+
133134
source.forEach { currentFile ->
134135
if (currentFile.isFile()) {
135136
copyFile(currentFile, destination)

app/src/main/java/com/raival/compose/file/explorer/screen/main/tab/regular/task/RegularTabMoveTask.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class RegularTabMoveTask(
9797
)
9898

9999
if (existingFile isNot null) {
100-
if (!existingFile!!.delete()) {
100+
if (existingFile!!.getParent()?.getPath() == to.getPath() || !existingFile.delete()) {
101101
skipped++
102102
return
103103
}

0 commit comments

Comments
 (0)