1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Properly open all selected files (tar content/atlas structure is however still case sensitive)

This commit is contained in:
Martin Tůma 2017-04-23 12:26:01 +02:00
parent e4e3f7d143
commit eace308774
2 changed files with 6 additions and 5 deletions

View File

@ -34,16 +34,16 @@ bool Atlas::isAtlas(Tar &tar, const QString &path)
{ {
QFileInfo fi(path); QFileInfo fi(path);
QByteArray ba; QByteArray ba;
QString suffix = fi.suffix().toLower();
if (suffix == "tar") {
if (fi.suffix() == "tar") {
if (!tar.load(path)) { if (!tar.load(path)) {
_errorString = "Error reading tar file"; _errorString = "Error reading tar file";
return false; return false;
} }
QString tbaFileName = fi.completeBaseName() + ".tba"; QString tbaFileName = fi.completeBaseName() + ".tba";
ba = tar.file(tbaFileName); ba = tar.file(tbaFileName);
} else if (fi.suffix() == "tba") { } else if (suffix == "tba") {
QFile tbaFile(path); QFile tbaFile(path);
if (!tbaFile.open(QIODevice::ReadOnly)) { if (!tbaFile.open(QIODevice::ReadOnly)) {
_errorString = QString("Error opening tba file: %1") _errorString = QString("Error opening tba file: %1")

View File

@ -417,6 +417,7 @@ OfflineMap::OfflineMap(const QString &fileName, QObject *parent)
QString proj, datum; QString proj, datum;
ProjectionSetup setup; ProjectionSetup setup;
QFileInfo fi(fileName); QFileInfo fi(fileName);
QString suffix = fi.suffix().toLower();
_valid = false; _valid = false;
@ -424,7 +425,7 @@ OfflineMap::OfflineMap(const QString &fileName, QObject *parent)
_projection = 0; _projection = 0;
_resolution = 0; _resolution = 0;
if (fi.suffix() == "tar") { if (suffix == "tar") {
if (!_tar.load(fileName)) { if (!_tar.load(fileName)) {
_errorString = "Error reading tar file"; _errorString = "Error reading tar file";
return; return;
@ -439,7 +440,7 @@ OfflineMap::OfflineMap(const QString &fileName, QObject *parent)
QBuffer mapFile(&ba); QBuffer mapFile(&ba);
if (!parseMapFile(mapFile, points, proj, setup, datum)) if (!parseMapFile(mapFile, points, proj, setup, datum))
return; return;
} else if (fi.suffix() =="map") { } else if (suffix =="map") {
QFile mapFile(fileName); QFile mapFile(fileName);
if (!parseMapFile(mapFile, points, proj, setup, datum)) if (!parseMapFile(mapFile, points, proj, setup, datum))
return; return;