@@ -1030,6 +1030,14 @@ void Skyscraper::loadConfig(const QCommandLineParser &parser) {
10301030 if (config.frontend == " retroarch" ) {
10311031 if (!inputFolderSet) {
10321032 config.inputFolder = frontend->getInputFolder ();
1033+ } else {
1034+ validateAbsolutePath (" inputFolder" , config.inputFolder );
1035+ }
1036+ if (gameListFolderSet) {
1037+ validateAbsolutePath (" gameListFolder" , config.gameListFolder );
1038+ }
1039+ if (mediaFolderSet) {
1040+ validateAbsolutePath (" mediaFolder" , config.mediaFolder );
10331041 }
10341042 // do call these ignoring gameListFolderSet and mediaFolderSet
10351043 // as they will adjust the path to retroarch specs
@@ -1067,7 +1075,6 @@ void Skyscraper::loadConfig(const QCommandLineParser &parser) {
10671075 PathTools::expandHomePath (config.inputFolder );
10681076 PathTools::expandHomePath (config.mediaFolder );
10691077
1070- const QFileInfo inputDirFileInfo = QFileInfo (config.inputFolder );
10711078 if (config.frontend == " pegasus" || config.frontend == " batocera" ) {
10721079 // defaults are always absolute, thus input- and mediafolder will be
10731080 // unchanged by these calls.
@@ -1083,10 +1090,10 @@ void Skyscraper::loadConfig(const QCommandLineParser &parser) {
10831090 config.mediaFolder = PathTools::makeAbsolutePath (config.gameListFolder ,
10841091 config.mediaFolder );
10851092 } else if (config.frontend == " retroarch" ) {
1086- checkForAbsoluteInputFolder (inputDirFileInfo);
1087- // media and gamelist folder already in proper format (see above)
1093+ ; // pass through, checks made above
10881094 } else {
1089- checkForAbsoluteInputFolder (inputDirFileInfo);
1095+ validateAbsolutePath (" inputFolder" , config.inputFolder );
1096+ const QFileInfo inputDirFileInfo = QFileInfo (config.inputFolder );
10901097 QString last = config.inputFolder .split (" /" ).last ();
10911098 config.gameListFolder = removeSurplusPlatformPath (
10921099 config.platform , last, config.gameListFolder );
@@ -1278,16 +1285,20 @@ void Skyscraper::loadConfig(const QCommandLineParser &parser) {
12781285 }
12791286}
12801287
1281- void Skyscraper::checkForAbsoluteInputFolder (
1282- const QFileInfo &inputDirFileInfo) {
1283- if (inputDirFileInfo.isRelative ()) {
1284- ncprintf (" \033 [1;31mBummer!\033 [0m The parameter 'inputFolder' is "
1285- " provided as relative path which is not valid for this "
1286- " frontend. Provide the input folder as absolute path to "
1287- " remediate. Now quitting...\n " );
1288+ void Skyscraper::validateAbsolutePath (const QString ¶m,
1289+ const QString &path) {
1290+ if (QFileInfo (path).isRelative ()) {
1291+ ncprintf (" \033 [1;31mBummer!\033 [0m The value of '%s' is "
1292+ " provided as relative path which is not valid for the "
1293+ " frontend '%s'. Provide '%s' as absolute path to "
1294+ " remediate. Now quitting...\n " ,
1295+ param.toStdString ().c_str (),
1296+ config.frontend .toStdString ().c_str (),
1297+ param.toStdString ().c_str ());
12881298 emit die (
1289- 1 , " invalid frontend and input folder combination" ,
1290- QString (" Input folder may not be a relative path for frontend '%1'" )
1299+ 1 , " invalid frontend and path combination" ,
1300+ QString (" path of '%1' may not be a relative path for frontend '%2'" )
1301+ .arg (param)
12911302 .arg (config.frontend ));
12921303 }
12931304}
0 commit comments