add:下载支持输入下载位置。
This commit is contained in:
parent
b683a05dea
commit
7d83b9aeb3
24
README.md
24
README.md
@ -37,7 +37,29 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 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 客户端标号 列表文件`
|
命令格式为:`Update 客户端标号 列表文件`
|
||||||
|
|
||||||
|
@ -134,7 +134,17 @@ bool CClient::down_task(const std::string& param)
|
|||||||
mpwarn("Have Task Downloading, Please wait.....");
|
mpwarn("Have Task Downloading, Please wait.....");
|
||||||
return false;
|
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)) {
|
if (!task_list_.count(id)) {
|
||||||
mperror("No matched id[{}] in task list.", id);
|
mperror("No matched id[{}] in task list.", id);
|
||||||
return false;
|
return false;
|
||||||
@ -155,7 +165,7 @@ bool CClient::down_task(const std::string& param)
|
|||||||
|
|
||||||
// 开始传输文件
|
// 开始传输文件
|
||||||
for (const auto& item : vec) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user