add:添加本地传输模式(主要处理不能操作同一个文件逻辑和变量替换逻辑)

This commit is contained in:
taynpg 2025-04-07 11:04:32 +08:00
parent f90b867f79
commit 1677765111
4 changed files with 26 additions and 9 deletions

View File

@ -20,9 +20,9 @@
} }
], ],
"visualizerFile": "${workspaceRoot}/.vscode/qt5.natvis", "visualizerFile": "${workspaceRoot}/.vscode/qt5.natvis",
// "args": [ "args": [
// "-n", "1" "-u", "0"
// ] ]
}, },
"cmake.environment": { "cmake.environment": {
"PATH": "${env:PATH};" "PATH": "${env:PATH};"

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(transm VERSION 1.3.1 LANGUAGES CXX) project(transm VERSION 1.3.2 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)

View File

@ -472,9 +472,10 @@ bool CClient::request_update_list(const std::string& param)
} }
const auto& sr = task_list_[index]; const auto& sr = task_list_[index];
bool local_trans = false;
if (sr->id == own_id_) { if (sr->id == own_id_) {
TLOGW("You can't update your own file!!!"); TLOGW("local_trans path handle mode!!!");
return false; local_trans = true;
} }
// 读取list文件 // 读取list文件
@ -513,13 +514,29 @@ bool CClient::request_update_list(const std::string& param)
auto v = COfStr::split(hitem, "|"); auto v = COfStr::split(hitem, "|");
if (v.size() >= 2) { if (v.size() >= 2) {
auto pr = variable_handle(list_file_full, v[0], true); auto pr = variable_handle(list_file_full, v[0], true);
pr = COfPath::standardize(pr);
if (!fs::exists(pr)) { if (!fs::exists(pr)) {
TLOGE("file {} not exist.", pr); TLOGE("file {} not exist.", pr);
valid = false; valid = false;
break; break;
} }
TLOGI("--->check pass {}:{}", line, pr); TLOGI("--->check pass {}:{}", line, pr);
mre[line++] = pr + "|" + v[1]; auto sec = v[1];
if (local_trans) {
sec = variable_handle(list_file_full, v[1], true);
sec = COfPath::standardize(sec);
if (!fs::is_directory(sec) || !fs::exists(sec)) {
TLOGE("not directory or {} not exist.", pr);
valid = false;
break;
}
if (COfPath::is_same_dir(pr, sec)) {
TLOGE("Local Trans Can't Transfer {} to {}", pr, sec);
valid = false;
break;
}
}
mre[line++] = pr + "|" + sec;
continue; continue;
} }
valid = false; valid = false;
@ -527,7 +544,7 @@ bool CClient::request_update_list(const std::string& param)
} }
if (!valid) { if (!valid) {
TLOGE("Judge List File {} Format Not Passed.", list_file_full); TLOGE("Judge List File {} Format Or Logic Not Passed.", list_file_full);
return false; return false;
} }

2
ofen

@ -1 +1 @@
Subproject commit c9ab756852084c1d6f8e5fb90c2e8d6c441a08d3 Subproject commit a667080d96395792cd3c6066ef0ebe6c8b508bbe