add:下载支持输入下载位置。

This commit is contained in:
taynpg 2025-02-13 18:39:13 +08:00
parent b683a05dea
commit 7d83b9aeb3
2 changed files with 35 additions and 3 deletions

View File

@ -37,7 +37,29 @@
![func2](https://www.sinxmiao.cn/taynpg/transm/raw/branch/main/img/func2.png)
### Update功能
### 3.1 Get功能
`v1.2.3`版本起(含),当某个客户端的列表文件数量过多时,只展示部分(会显示总数量)。
### 3.2 Up功能
`v1.2.3`版本起(含),`up`后路径支持`?``*`通配符:
```shell
up /home/zhang/png/cloud*.png|/home/zhang/download/202?-*.exe
```
### 3.3 Down功能
`v1.2.3`版本起(含),支持传入下载位置(默认命令所在目录):
```shell
down 1 dira/dirb
down 1 ../download
down 2 /home/zhang/document
```
### 3.4 Update功能
命令格式为:`Update 客户端标号 列表文件`

View File

@ -134,7 +134,17 @@ bool CClient::down_task(const std::string& param)
mpwarn("Have Task Downloading, Please wait.....");
return false;
}
int id = std::stoi(param);
std::string relative_path;
auto v = COfStr::split(param, " ");
if (v.size() < 1) {
mperror("param size not enough.");
return false;
}
if (v.size() > 1) {
relative_path = v[1];
}
auto id = std::stoi(v[0]);
if (!task_list_.count(id)) {
mperror("No matched id[{}] in task list.", id);
return false;
@ -155,7 +165,7 @@ bool CClient::down_task(const std::string& param)
// 开始传输文件
for (const auto& item : vec) {
if (!down_one_file(task_list_[id]->id, item)) {
if (!down_one_file(task_list_[id]->id, item, relative_path)) {
break;
}
std::this_thread::sleep_for(std::chrono::milliseconds(20));