@@ -83,10 +83,26 @@ fun FilePasteBar(
8383 }
8484
8585 val dstFile = File (dstCanonical, srcCanonical.name)
86- if (! dstFile.exists()) {
87- srcCanonical.toPath().moveTo(dstFile.toPath(), true )
88- } else {
89- srcCanonical.toPath().moveTo(Path (dstFile.newPath()), true )
86+ try {
87+ if (! dstFile.exists()) {
88+ srcCanonical.toPath().moveTo(dstFile.toPath(), true )
89+ } else {
90+ srcCanonical.toPath().moveTo(Path (dstFile.newPath()), true )
91+ }
92+ } catch (e: Exception ) {
93+ // Fallback: copy then delete (handles cross-filesystem moves)
94+ try {
95+ val target = if (! dstFile.exists()) dstFile else File (dstFile.newPath())
96+ if (srcCanonical.isDirectory) {
97+ srcCanonical.copyRecursively(target, true )
98+ srcCanonical.deleteRecursively()
99+ } else {
100+ srcCanonical.copyTo(target, true )
101+ srcCanonical.delete()
102+ }
103+ } catch (ex: Exception ) {
104+ DialogHelper .showErrorMessage(ex.message ? : LocaleHelper .getString(R .string.unknown_error))
105+ }
90106 }
91107 }
92108 filesVM.cutFiles.clear()
@@ -113,10 +129,14 @@ fun FilePasteBar(
113129 }
114130
115131 val dstFile = File (dstCanonical, srcCanonical.name)
116- if (! dstFile.exists()) {
117- srcCanonical.copyRecursively(dstFile, true )
118- } else {
119- srcCanonical.copyRecursively(File (dstFile.newPath()), true )
132+ try {
133+ if (! dstFile.exists()) {
134+ srcCanonical.copyRecursively(dstFile, true )
135+ } else {
136+ srcCanonical.copyRecursively(File (dstFile.newPath()), true )
137+ }
138+ } catch (e: Exception ) {
139+ DialogHelper .showErrorMessage(e.message ? : LocaleHelper .getString(R .string.unknown_error))
120140 }
121141 }
122142 filesVM.copyFiles.clear()
0 commit comments