aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorEvgeniy A. Dushistov <dushistov@mail.ru>2021-04-13 14:13:14 +0300
committerUlf Hermann <ulf.hermann@qt.io>2021-04-14 12:10:07 +0000
commit45aa0853dae3f3068af08a6ed2d3248155e13e24 (patch)
tree15b6f355d4a7e354b4cc5fce638d2639f2e48db8 /tools
parent2b34dcba8463c592feae52b39ab332e497120eec (diff)
qmlformat: fix QFSFileEngine::open: No file name specified
Since commit d48b87450327e710f7b0a843627624aa67cae116 qmlformat prints the message: QFSFileEngine::open: No file name specified on normal usage like: qmlformat path/to/qml qmlformat -i path/to/qml This is because it tries to open the file specific by the "files" option event if no such option was passed. Pick-to: 6.0 6.1 Change-Id: Id14247210fc77a3f10dc25866607a9952fe81dfa Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlformat/main.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/tools/qmlformat/main.cpp b/tools/qmlformat/main.cpp
index da3c1772fb..3f11ce257a 100644
--- a/tools/qmlformat/main.cpp
+++ b/tools/qmlformat/main.cpp
@@ -224,17 +224,19 @@ Options buildCommandLineOptions(const QCoreApplication &app)
}
QStringList files;
- QFile file(parser.value("files"));
- file.open(QIODevice::Text | QIODevice::ReadOnly);
- if (file.isOpen()) {
- QTextStream in(&file);
- while (!in.atEnd()) {
- QString file = in.readLine();
-
- if (file.isEmpty())
- continue;
-
- files.push_back(file);
+ if (parser.isSet("files")) {
+ QFile file(parser.value("files"));
+ file.open(QIODevice::Text | QIODevice::ReadOnly);
+ if (file.isOpen()) {
+ QTextStream in(&file);
+ while (!in.atEnd()) {
+ QString file = in.readLine();
+
+ if (file.isEmpty())
+ continue;
+
+ files.push_back(file);
+ }
}
}