#25 fix sftp rmdir

This commit is contained in:
lollipopkit
2023-04-16 16:26:50 +08:00
parent 8ba888a5b3
commit a3537a67c2
6 changed files with 23 additions and 4 deletions

View File

@@ -326,18 +326,23 @@ class _SFTPPageState extends State<SFTPPage> {
void delete(BuildContext context, SftpName file) {
Navigator.of(context).pop();
final isDir = file.attr.isDirectory;
showRoundDialog(
context,
_s.attention,
Text(_s.sureDelete(file.filename)),
Text('${_s.sureDelete(file.filename)}\n${isDir ? _s.sureDirEmpty : ''}'),
[
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Cancel'),
child: Text(_s.cancel),
),
TextButton(
onPressed: () {
_status.client!.remove(file.filename);
onPressed: () async {
if (file.attr.isDirectory) {
await _status.client!.rmdir(file.filename);
} else {
await _status.client!.remove(file.filename);
}
Navigator.of(context).pop();
listDir();
},