From e34f77f1a128aa4c80dccda7cf405ffa0d1f4d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 28 Aug 2023 20:18:38 +0200 Subject: [PATCH] Use the real file names for suffix extraction on Android Many file URLs/paths that are passed to GPXSee on Android are unusable for extracting the file suffix due to the Android file name mangling. Use the converted "display names" for suffix extraction where possible. --- src/data/data.cpp | 3 ++- src/map/maplist.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/data/data.cpp b/src/data/data.cpp index 7559bec9..5d513feb 100644 --- a/src/data/data.cpp +++ b/src/data/data.cpp @@ -1,6 +1,7 @@ #include #include #include +#include "common/util.h" #include "gpxparser.h" #include "tcxparser.h" #include "csvparser.h" @@ -94,7 +95,7 @@ void Data::processData(QList &trackData, QList &routeData) Data::Data(const QString &fileName, bool tryUnknown) { QFile file(fileName); - QFileInfo fi(fileName); + QFileInfo fi(Util::displayName(fileName)); QList trackData; QList routeData; diff --git a/src/map/maplist.cpp b/src/map/maplist.cpp index fd684937..fec2aa93 100644 --- a/src/map/maplist.cpp +++ b/src/map/maplist.cpp @@ -65,7 +65,7 @@ MapList::ParserMap MapList::_parsers = parsers(); Map *MapList::loadFile(const QString &path, bool *isDir) { ParserMap::iterator it; - QFileInfo fi(path); + QFileInfo fi(Util::displayName(path)); QString suffix(fi.completeSuffix().toLower()); Map *map = 0; QStringList errors;