mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 00:50:31 +00:00
Fix move transfer operation
This commit is contained in:
parent
9212871db9
commit
66f6b69cbe
1 changed files with 12 additions and 3 deletions
|
@ -111,13 +111,19 @@ public class BrowserFileTransferOperation {
|
|||
}
|
||||
|
||||
for (var file : files) {
|
||||
if (file.getFileSystem().equals(target.getFileSystem())) {
|
||||
if (same) {
|
||||
handleSingleOnSameFileSystem(file);
|
||||
updateProgress(BrowserTransferProgress.finished(file.getName(), file.getSize()));
|
||||
} else {
|
||||
handleSingleAcrossFileSystems(file);
|
||||
}
|
||||
}
|
||||
|
||||
if (!same && doesMove) {
|
||||
for (var file : files) {
|
||||
deleteSingle(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSingleOnSameFileSystem(FileSystem.FileEntry source)
|
||||
|
@ -143,8 +149,7 @@ public class BrowserFileTransferOperation {
|
|||
return;
|
||||
}
|
||||
|
||||
var same = files.getFirst().getFileSystem().equals(target.getFileSystem());
|
||||
var doesMove = transferMode == BrowserFileTransferMode.MOVE || (same && transferMode == BrowserFileTransferMode.NORMAL);
|
||||
var doesMove = transferMode == BrowserFileTransferMode.MOVE || transferMode == BrowserFileTransferMode.NORMAL;
|
||||
if (doesMove) {
|
||||
target.getFileSystem().move(sourceFile, targetFile);
|
||||
} else {
|
||||
|
@ -266,6 +271,10 @@ public class BrowserFileTransferOperation {
|
|||
updateProgress(BrowserTransferProgress.finished(source.getName(), totalSize.get()));
|
||||
}
|
||||
|
||||
private void deleteSingle(FileSystem.FileEntry source) throws Exception {
|
||||
source.getFileSystem().delete(source.getPath());
|
||||
}
|
||||
|
||||
private static final int DEFAULT_BUFFER_SIZE = 1024;
|
||||
|
||||
private void transferFile(
|
||||
|
|
Loading…
Reference in a new issue