From 89919b9f7ff1872d345bc1cc6c9e24e65dda51d4 Mon Sep 17 00:00:00 2001 From: Rafael Date: Wed, 23 Mar 2016 02:18:50 +0100 Subject: [PATCH] Auto opening detect if is Snapmatic picture or Savegame file --- main.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 1bad84c..e69d8ae 100755 --- a/main.cpp +++ b/main.cpp @@ -25,8 +25,10 @@ #include "SavegameData.h" #include #include +#include #include #include +#include #include 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"; + } } } }