fix:修正Linux下获取文件名为全路径的错误问题,修正Linux的pthread库未链接的问题。
This commit is contained in:
parent
a2df59cc07
commit
8889bd061d
@ -9,4 +9,7 @@ if (MSVC)
|
||||
endif()
|
||||
|
||||
add_executable(transmc main.cpp client.h client.cpp file_oper.h file_oper.cpp)
|
||||
target_link_libraries(transmc PRIVATE trans_net trans_util)
|
||||
target_link_libraries(transmc PRIVATE trans_net trans_util)
|
||||
if (UNIX)
|
||||
target_link_libraries(transmc PRIVATE pthread)
|
||||
endif()
|
@ -89,7 +89,6 @@ bool CClient::down_task(const std::string& param)
|
||||
|
||||
// 开始传输文件
|
||||
for (const auto& item : vec) {
|
||||
logger_->warn("Start Down => {}", item);
|
||||
down_one_file(task_list_[id]->id, item);
|
||||
}
|
||||
return true;
|
||||
@ -130,8 +129,9 @@ bool CClient::down_one_file(const std::string& id, const std::string& file)
|
||||
down_->cur_remote_id_ = id;
|
||||
down_->cur_remote_file_ = file;
|
||||
|
||||
fs::path remote_file(down_->cur_remote_file_);
|
||||
fs::path remote_file(ofen::COfPath::normalize(down_->cur_remote_file_));
|
||||
down_->cur_file_ = COfPath::to_full(remote_file.filename().string());
|
||||
logger_->warn("Start Down => {} To {}", file, down_->cur_file_);
|
||||
|
||||
// 请求下载文件
|
||||
std::shared_ptr<CFrameBuffer> buf = std::make_shared<CFrameBuffer>();
|
||||
@ -155,6 +155,7 @@ void CClient::cancel_trans_file(const std::string& key)
|
||||
if (key.empty()) {
|
||||
t = down_;
|
||||
} else {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
if (up_.count(key)) {
|
||||
t = up_[key];
|
||||
}
|
||||
|
@ -8,4 +8,7 @@ if (MSVC)
|
||||
endif()
|
||||
|
||||
add_executable(transms main.cpp server.h server.cpp)
|
||||
target_link_libraries(transms PRIVATE trans_net trans_util)
|
||||
target_link_libraries(transms PRIVATE trans_net trans_util)
|
||||
if (UNIX)
|
||||
target_link_libraries(transms PRIVATE pthread)
|
||||
endif()
|
Loading…
x
Reference in New Issue
Block a user