From 5518492c4d31b1d2a8cfa7582dcbe6e6cbcc20c3 Mon Sep 17 00:00:00 2001 From: GPayne Date: Tue, 6 Jun 2023 23:19:49 -0600 Subject: [PATCH 1/2] Fix for correctly handling horizons vector header on linux --- modules/space/horizonsfile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/space/horizonsfile.cpp b/modules/space/horizonsfile.cpp index cdf1e2efb9..94b2c6040c 100644 --- a/modules/space/horizonsfile.cpp +++ b/modules/space/horizonsfile.cpp @@ -504,8 +504,9 @@ HorizonsResult readHorizonsFile(std::filesystem::path file) { // " Before data starts, Observer table doesn't std::string line; std::getline(fileStream, line); + const std::string vectorTabHeader = "JDTDB"; while (line[0] != '$') { - if (line == "JDTDB") { + if (line.substr(0, vectorTabHeader.size()) == vectorTabHeader) { fileStream.close(); return readHorizonsVectorFile(file); } From 023275a06126a43560e6f7a359275278bdee635b Mon Sep 17 00:00:00 2001 From: GPayne Date: Wed, 7 Jun 2023 15:16:03 -0600 Subject: [PATCH 2/2] Switch to C++20 string starts_with for vector header --- modules/space/horizonsfile.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/space/horizonsfile.cpp b/modules/space/horizonsfile.cpp index 94b2c6040c..6e4bb00c0f 100644 --- a/modules/space/horizonsfile.cpp +++ b/modules/space/horizonsfile.cpp @@ -504,9 +504,8 @@ HorizonsResult readHorizonsFile(std::filesystem::path file) { // " Before data starts, Observer table doesn't std::string line; std::getline(fileStream, line); - const std::string vectorTabHeader = "JDTDB"; while (line[0] != '$') { - if (line.substr(0, vectorTabHeader.size()) == vectorTabHeader) { + if (line.starts_with("JDTDB")) { fileStream.close(); return readHorizonsVectorFile(file); }