From 1677765111abb65aab9fd5392434f544c593ee10 Mon Sep 17 00:00:00 2001 From: taynpg Date: Mon, 7 Apr 2025 11:04:32 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=E6=B7=BB=E5=8A=A0=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E4=BC=A0=E8=BE=93=E6=A8=A1=E5=BC=8F=EF=BC=88=E4=B8=BB?= =?UTF-8?q?=E8=A6=81=E5=A4=84=E7=90=86=E4=B8=8D=E8=83=BD=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E5=90=8C=E4=B8=80=E4=B8=AA=E6=96=87=E4=BB=B6=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=92=8C=E5=8F=98=E9=87=8F=E6=9B=BF=E6=8D=A2=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 6 +++--- CMakeLists.txt | 2 +- client/client.cpp | 25 +++++++++++++++++++++---- ofen | 2 +- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7ba932b..69bc411 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,9 +20,9 @@ } ], "visualizerFile": "${workspaceRoot}/.vscode/qt5.natvis", - // "args": [ - // "-n", "1" - // ] + "args": [ + "-u", "0" + ] }, "cmake.environment": { "PATH": "${env:PATH};" diff --git a/CMakeLists.txt b/CMakeLists.txt index ac76166..e5454a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ 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_REQUIRED ON) diff --git a/client/client.cpp b/client/client.cpp index dd8d01c..55940f8 100644 --- a/client/client.cpp +++ b/client/client.cpp @@ -472,9 +472,10 @@ bool CClient::request_update_list(const std::string& param) } const auto& sr = task_list_[index]; + bool local_trans = false; if (sr->id == own_id_) { - TLOGW("You can't update your own file!!!"); - return false; + TLOGW("local_trans path handle mode!!!"); + local_trans = true; } // 读取list文件 @@ -513,13 +514,29 @@ bool CClient::request_update_list(const std::string& param) auto v = COfStr::split(hitem, "|"); if (v.size() >= 2) { auto pr = variable_handle(list_file_full, v[0], true); + pr = COfPath::standardize(pr); if (!fs::exists(pr)) { TLOGE("file {} not exist.", pr); valid = false; break; } 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; } valid = false; @@ -527,7 +544,7 @@ bool CClient::request_update_list(const std::string& param) } 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; } diff --git a/ofen b/ofen index c9ab756..a667080 160000 --- a/ofen +++ b/ofen @@ -1 +1 @@ -Subproject commit c9ab756852084c1d6f8e5fb90c2e8d6c441a08d3 +Subproject commit a667080d96395792cd3c6066ef0ebe6c8b508bbe