From 1bb061db79965928aad10d021b1ffa173536b549 Mon Sep 17 00:00:00 2001
From: Juraj Fedel <wtxnh-scribus@yahoo.com.au>
Date: Sat, 10 Oct 2015 15:07:18 +0200
Subject: [PATCH 7/7] Allow sla files to be intermixed with other options

This will remove the requirement for all sla files to be specified at
the end of command line. Now it is possible to specify sla document at
any place (before --python-script option):

$ scribus-1.5.1.svn document.sla -g -py arg_scr.py -flag1 -arg2 val2 -flag3

If you have some --funny-name.sla (beginning with dash) you still need
to use -- delimiter (this is main reason for existence of -- delimiter
in most programs):

$ scribus-1.5.1.svn document.sla -g -py arg_scr.py -flag1 -arg2 val2 -flag3 -- --funny-name.sla
---
 scribus/scribusapp.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/scribus/scribusapp.cpp b/scribus/scribusapp.cpp
index 63563ad..52e77f6 100644
--- a/scribus/scribusapp.cpp
+++ b/scribus/scribusapp.cpp
@@ -260,7 +260,13 @@ void ScribusQApp::parseCommandLine()
 				std::cout << tr("Invalid argument: %1").arg(arg).toLocal8Bit().data() << std::endl;
 				std::exit(EXIT_FAILURE);
 			}
-			break;
+			fileName = QFile::decodeName(args[argi].toLocal8Bit());
+			if (!QFileInfo(fileName).exists()) {
+				std::cout << tr("File %1 does not exist, aborting.").arg(fileName).toLocal8Bit().data() << std::endl;
+				std::exit(EXIT_FAILURE);
+			} else {
+				filesToLoad.append(fileName);
+			}
 		}
 	}
 	// parse for remaining (positional) arguments, if any
-- 
2.1.4

