Skip to content

Commit d2ce21b

Browse files
committed
srtm: fix for old cached srtm files
1 parent a392fc3 commit d2ce21b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ExtLibs/Utilities/srtm.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
using System.Threading.Tasks;
1111
using log4net;
1212
using GMap.NET;
13+
using System.Linq;
14+
using System.Transactions;
1315

1416
namespace MissionPlanner.Utilities
1517
{
@@ -97,6 +99,16 @@ static srtm()
9799
client.DefaultRequestHeaders.Add("User-Agent", Settings.Instance.UserAgent);
98100

99101
StartQueueProcess();
102+
103+
Directory.GetFiles(datadirectory).ToList().ForEach(x =>
104+
{
105+
var fi = new FileInfo(x);
106+
if (fi.Length == 0)
107+
File.Delete(x);
108+
// fix srtm3 bug cache - delete old files https://discuss.ardupilot.org/t/serious-terrain-data-error-and-how-to-fix-your-vehicle/142593
109+
if (fi.LastWriteTimeUtc < new DateTime(2026,03,01,0,0,0, DateTimeKind.Utc))
110+
File.Delete(x);
111+
});
100112
}
101113

102114
static string GetFilename(double lat, double lng)

0 commit comments

Comments
 (0)