From a6ade4939f58fa89488cf050d7d5029b1ee04a80 Mon Sep 17 00:00:00 2001 From: gaozheng Date: Wed, 1 Jul 2026 08:22:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(core):=20GeoVolumeBuilder=20=E5=A4=96?= =?UTF-8?q?=E9=83=A8=E6=96=87=E4=BB=B6=E6=89=93=E5=BC=80=E8=B5=B0=20localP?= =?UTF-8?q?ath=EF=BC=8C=E6=94=AF=E6=8C=81=E4=B8=AD=E6=96=87=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit readHeaderFor() 的 .iprh 路径构造、totalTracesOf() 的 fs::file_size、 buildGeoVolume() 的 .ord ifstream,三处均改走 geopro::io::gpr::localPath, 与 io/gpr 层已修路径保持一致,消除含中文目录时打开失败的同类缺口。 parseGps / readIprbRange 已在各自实现层包裹,无需重包。 --- src/core/algo/GeoVolumeBuilder.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/algo/GeoVolumeBuilder.cpp b/src/core/algo/GeoVolumeBuilder.cpp index 201ce71..037380b 100644 --- a/src/core/algo/GeoVolumeBuilder.cpp +++ b/src/core/algo/GeoVolumeBuilder.cpp @@ -22,6 +22,7 @@ #include "io/gpr/GpsTrack.hpp" #include "io/gpr/IprHeader.hpp" #include "io/gpr/IprbReader.hpp" +#include "io/gpr/LocalPath.hpp" namespace fs = std::filesystem; @@ -33,7 +34,7 @@ constexpr double kPi = 3.14159265358979323846; // 读 .iprh 文本 → 解析头(与 .iprb 同名)。 geopro::io::gpr::IprHeader readHeaderFor(const std::string& iprbPath) { - fs::path h = fs::path(iprbPath).replace_extension(".iprh"); + fs::path h = geopro::io::gpr::localPath(iprbPath).replace_extension(".iprh"); std::ifstream f(h); if (!f) throw std::runtime_error("GeoVolumeBuilder: 打不开 iprh " + h.string()); std::string text((std::istreambuf_iterator(f)), @@ -55,7 +56,7 @@ std::int64_t totalTracesOf(const std::vector& iprb, int samples) { const std::int64_t per = static_cast(samples) * 2; if (per <= 0) throw std::runtime_error("samples<=0"); for (const auto& p : iprb) { - const std::int64_t bytes = static_cast(fs::file_size(p)); + const std::int64_t bytes = static_cast(fs::file_size(geopro::io::gpr::localPath(p))); minTr = std::min(minTr, bytes / per); } return minTr; @@ -137,7 +138,7 @@ GeoBuildResult buildGeoVolume(const std::vector& lines, for (const auto& p : tracks[i].pts) sc.trackM.push_back(lonLatToLocalM(p.lat, p.lon, minLat, minLon)); - std::ifstream ordF(lines[i].ord); + std::ifstream ordF(geopro::io::gpr::localPath(lines[i].ord)); if (!ordF) throw std::runtime_error("buildGeoVolume: 打不开 ord " + lines[i].ord); std::string ordText((std::istreambuf_iterator(ordF)), std::istreambuf_iterator());