#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

@@ -152,6 +152,7 @@
"stop": "Stop",
"success": "Success",
"sureDelete": "Are you sure to delete [{name}]?",
"sureDirEmpty": "Make sure dir is empty.",
"sureNoPwd": "Are you sure to use no password?",
"sureToDeleteServer": "Are you sure to delete server [{server}]?",
"termTheme": "Terminal theme",

View File

@@ -152,6 +152,7 @@
"stop": "停止",
"success": "成功",
"sureDelete": "确定删除[{name}]",
"sureDirEmpty": "请确保文件夹为空",
"sureNoPwd": "确认使用无密码?",
"sureToDeleteServer": "你确定要删除服务器 [{server}] 吗?",
"termTheme": "终端主题",

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();
},