Allow the specification of includes in the lst-file in lupdate.
authorStephen Kelly <stephen.kelly@kdab.com>
Tue, 19 Jun 2012 16:05:44 +0000 (18:05 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 21 Jun 2012 09:29:07 +0000 (11:29 +0200)
Change-Id: I95805637b7c1bb7f6774a47928f21701ba212298
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
src/linguist/lupdate/main.cpp

index 74fce20..7ae3fe6 100644 (file)
@@ -140,7 +140,8 @@ static void printUsage()
         "    -version\n"
         "           Display the version of lupdate and exit.\n"
         "    @lst-file\n"
-        "           Read additional file names (one per line) from lst-file.\n"
+        "           Read additional file names (one per line) or includepaths (one per\n"
+        "           line, and prefixed with -I) from lst-file.\n"
     ).arg(m_defaultExtensions));
 }
 
@@ -642,8 +643,19 @@ int main(int argc, char **argv)
                          .arg(lstFile.fileName()));
                 return 1;
             }
-            while (!lstFile.atEnd())
-                files << QString::fromLocal8Bit(lstFile.readLine().trimmed());
+            while (!lstFile.atEnd()) {
+                QString lineContent = QString::fromLocal8Bit(lstFile.readLine().trimmed());
+
+                if (lineContent.startsWith(QLatin1Literal("-I"))) {
+                    if (lineContent.length() == 2) {
+                        printErr(LU::tr("The -I option should be followed by a path.\n"));
+                        return 1;
+                    }
+                    includePath += lineContent.mid(2);
+                } else {
+                    files << lineContent;
+                }
+            }
         } else {
             files << arg;
         }