summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
authorLincoln Ramsay <lincoln.ramsay@nokia.com>2009-04-21 06:33:04 (GMT)
committerLincoln Ramsay <lincoln.ramsay@nokia.com>2009-04-21 06:33:04 (GMT)
commitf8c7de54eaf3e9165e41f212a13dd794ce7063a9 (patch)
tree1be0287015efbc0c1a36a1909a66776641edb13d /qmake/generators
parent07703ade86edcd6565c373f63e34306209d1a90a (diff)
downloadQt-f8c7de54eaf3e9165e41f212a13dd794ce7063a9.zip
Qt-f8c7de54eaf3e9165e41f212a13dd794ce7063a9.tar.gz
Qt-f8c7de54eaf3e9165e41f212a13dd794ce7063a9.tar.bz2
Missing debug .rc file with a clean shadow build
When generating Windows Makefiles, qmake writes out a .rc file for each of debug and release (unless you've limited to just one build type). When doing a clean shadow build, the first .rc file is written into a directory that does not exist but the code was not handling the error case. The fix does 2 things. 1) Attempt to create the destination directory if we can't write the file. 2) Die with an error if we still can't write the file after doing #1. Reviewed-by: Marius Storm-Olsen
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/win32/winmakefile.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 60a27be..87f55cf 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -432,9 +432,21 @@ void Win32MakefileGenerator::processRcFileVar()
writeRcFile = rcFile.readAll() != rcString;
rcFile.close();
}
- if (writeRcFile && rcFile.open(QFile::WriteOnly)) {
- rcFile.write(rcString);
- rcFile.close();
+ if (writeRcFile) {
+ bool ok;
+ ok = rcFile.open(QFile::WriteOnly);
+ if (!ok) {
+ // The file can't be opened... try creating the containing
+ // directory first (needed for clean shadow builds)
+ QDir().mkpath(QFileInfo(rcFile).path());
+ ok = rcFile.open(QFile::WriteOnly);
+ }
+ if (!ok) {
+ ::fprintf(stderr, "Cannot open for writing: %s", rcFile.fileName().toLatin1().constData());
+ ::exit(1);
+ }
+ rcFile.write(rcString);
+ rcFile.close();
}
if (project->values("QMAKE_WRITE_DEFAULT_RC").isEmpty())
project->values("RC_FILE").insert(0, rcFile.fileName());