Auto opening detect if is Snapmatic picture or Savegame file

This commit is contained in:
Rafael 2016-03-23 02:18:50 +01:00
parent c126840e4c
commit 89919b9f7f

View file

@ -25,8 +25,10 @@
#include "SavegameData.h"
#include <QApplication>
#include <QStringList>
#include <QFileInfo>
#include <QObject>
#include <QString>
#include <QDebug>
#include <QFile>
int main(int argc, char *argv[])
@ -58,10 +60,22 @@ int main(int argc, char *argv[])
else if (selectedAction == "")
{
QFile argumentFile(currentArg);
QFileInfo argumentFileInfo(argumentFile);
if (argumentFile.exists())
{
arg1 = currentArg;
selectedAction = "showpic";
QString argumentFileName = argumentFileInfo.fileName();
QString argumentFileType = argumentFileName.left(4);
if (argumentFileType == "PGTA")
{
arg1 = currentArg;
selectedAction = "showpic";
}
else if (argumentFileType == "SGTA")
{
arg1 = currentArg;
selectedAction = "showsgd";
}
}
}
}