move working

This commit is contained in:
RafayAhmad7548 2025-08-14 15:45:41 +05:00
parent 7ea9e98789
commit a66ed70532
4 changed files with 107 additions and 2 deletions

View file

@ -50,6 +50,13 @@ class DownloadFile extends SftpCommand {
DownloadFile(this.file, this.path, this.downloadPath);
}
class Copy extends SftpCommand {
final String filePath;
final String copyToPath;
Copy(this.filePath, this.copyToPath);
}
class SftpWorker {
@ -227,6 +234,15 @@ class SftpWorker {
}
case DownloadFile():
downloadController.add((id, command));
case Copy(:final filePath, :final copyToPath):
try {
// TODO: complete this
sendPort.send((id, 0));
}
on SftpStatusError catch (e) {
sendPort.send((id, RemoteError(e.message, '')));
}
}
});
}
@ -309,4 +325,12 @@ class SftpWorker {
return controller.stream;
}
Future<void> copy(String filePath, String copyToPath) async {
final completer = Completer.sync();
final id = _idCounter++;
_activeRequests[id] = completer;
_commands.send((id, Copy(filePath, copyToPath)));
await completer.future;
}
}