mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-01-15 21:45:19 +01:00
refactor(sftp): Replace hard-coded path separators with Pfs.seperator (#993)
Unify the use of Pfs.seperator for handling file path separators to enhance cross-platform compatibility.
This commit is contained in:
@@ -36,7 +36,7 @@ class SftpReqStatus {
|
||||
late SftpWorker worker;
|
||||
final Completer? completer;
|
||||
|
||||
String get fileName => req.localPath.split('/').last;
|
||||
String get fileName => req.localPath.split(Pfs.seperator).last;
|
||||
|
||||
// status of the download
|
||||
double? progress;
|
||||
|
||||
@@ -70,7 +70,7 @@ Future<void> _download(SftpReq req, SendPort mainSendPort, SendErrorFunction sen
|
||||
mainSendPort.send(SftpWorkerStatus.sshConnectted);
|
||||
|
||||
/// Create the directory if not exists
|
||||
final dirPath = req.localPath.substring(0, req.localPath.lastIndexOf('/'));
|
||||
final dirPath = req.localPath.substring(0, req.localPath.lastIndexOf(Pfs.seperator));
|
||||
await Directory(dirPath).create(recursive: true);
|
||||
|
||||
/// Use [FileMode.write] to overwrite the file
|
||||
|
||||
Reference in New Issue
Block a user