Examples: Better check for non-writable location

Checking the .pro file is actually not too relevant, so extend the check
to the .pro files directory, and more importantly, to the directory
above, which will be used as the default location for shadow build
directories.

Change-Id: I867118902abb2cf4b621e976b6ba953ef8f0431a
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
Eike Ziller
2015-04-27 09:28:35 +02:00
parent 63373ecc1d
commit c9af39eb34

View File

@@ -403,9 +403,13 @@ void ExamplesWelcomePage::openProject(const QString &projectFile,
if (!proFileInfo.exists())
return;
QFileInfo pathInfo(proFileInfo.path());
// If the Qt is a distro Qt on Linux, it will not be writable, hence compilation will fail
if (!proFileInfo.isWritable())
if (!proFileInfo.isWritable()
|| !pathInfo.isWritable() /* path of .pro file */
|| !QFileInfo(pathInfo.path()).isWritable() /* shadow build directory */) {
proFile = copyToAlternativeLocation(proFileInfo, filesToOpen, dependencies);
}
// don't try to load help and files if loading the help request is being cancelled
QString errorMessage;