From 41e43eeba0601ac4841157bfbecbeec4aa167221 Mon Sep 17 00:00:00 2001 From: Automatic Release Builder Date: Tue, 6 Oct 2020 23:28:08 +0100 Subject: [PATCH] TerraSync: fix Windows behaviour SGDir on Windows returns dot-files by default, which includes our hash-cache, causing it to be orphaned. --- simgear/io/HTTPRepository.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx index ad7325e1..57af6e68 100644 --- a/simgear/io/HTTPRepository.cxx +++ b/simgear/io/HTTPRepository.cxx @@ -313,7 +313,15 @@ public: simgear::Dir d(absolutePath()); PathList fsChildren = d.children(0); - PathList orphans = d.children(0); + PathList orphans = fsChildren; + + // on Windows, children() will return our .hashes and .dirIndex + // entries; skip them. + orphans.erase(std::remove_if(orphans.begin(), orphans.end(), + [](const SGPath &p) { + return p.file().front() == '.'; + }), + orphans.end()); for (const auto &c : children) { // Check if the file exists