fix: uploaded file's path on windows (#484)

This commit is contained in:
lollipopkit🏳️‍⚧️
2024-07-23 19:59:58 +08:00
committed by GitHub
parent afda5fd4a4
commit 426e5689f8
7 changed files with 36 additions and 32 deletions

View File

@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:dartssh2/dartssh2.dart';
import 'package:fl_lib/fl_lib.dart';
@@ -212,7 +213,8 @@ class _SftpPageState extends State<SftpPage> with AfterLayoutMixin {
context.showSnackBar('remote path is null');
return;
}
final remotePath = '$remoteDir/${path.split('/').last}';
final fileName = path.split(Platform.pathSeparator).lastOrNull;
final remotePath = '$remoteDir/$fileName';
Loggers.app.info('SFTP upload local: $path, remote: $remotePath');
Pros.sftp.add(
SftpReq(widget.spi, remotePath, path, SftpReqType.upload),