diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-03-22 17:22:47 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-03-27 04:24:11 +0100 |
commit | a0a990863fa54b52db5e97716b130f69de47fa52 (patch) | |
tree | 2145d924e8927a9fcd0502ad212c849ddbb6abc9 /qmake | |
parent | 8414a0aa2c22e2656bccc97600a59c7163d040c2 (diff) |
QMake: make it error out if it cannot open output files
Change-Id: I02c979e31f4208cbf9d590e043cf7f03eb4a39d6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/metamakefile.cpp | 5 | ||||
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.cpp | 10 |
2 files changed, 12 insertions, 3 deletions
diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index c9235509f2..79443a1d4b 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -140,7 +140,10 @@ BuildsMetaMakefileGenerator::write() if(Option::output.fileName() == "-") { Option::output.setFileName(""); Option::output_dir = qmake_getpwd(); - Option::output.open(stdout, QIODevice::WriteOnly | QIODevice::Text); + if (!Option::output.open(stdout, QIODevice::WriteOnly | QIODevice::Text)) { + fprintf(stderr, "Failure to open stdout\n"); + return false; + } using_stdout = true; } else { if(Option::output.fileName().isEmpty() && diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 7cbb44dde4..3147f24961 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -512,7 +512,10 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) QFile filterFile; filterFile.setFileName(Option::output.fileName().append(".filters")); - filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + if (!filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { + warn_msg(WarnLogic, "Generator: cannot open output filter file"); + return; + } QTextStream ts(&filterFile); XmlOutput xmlFilter(ts, XmlOutput::NoConversion); @@ -751,7 +754,10 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) // The file filters are added in a separate file for MSBUILD. QFile filterFile; filterFile.setFileName(Option::output.fileName().append(".filters")); - filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); + if (filterFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { + warn_msg(WarnLogic, "Cannot open output filter file"); + return; + } QTextStream ts(&filterFile); XmlOutput xmlFilter(ts, XmlOutput::NoConversion); |