From c9af39eb34d4f0e37f01236f680d422b10d157bd Mon Sep 17 00:00:00 2001
From: Eike Ziller <eike.ziller@theqtcompany.com>
Date: Mon, 27 Apr 2015 09:28:35 +0200
Subject: [PATCH] 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>
---
 src/plugins/qtsupport/gettingstartedwelcomepage.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
index 7a6ab92ff68..4268c645ccc 100644
--- a/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
+++ b/src/plugins/qtsupport/gettingstartedwelcomepage.cpp
@@ -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;
-- 
GitLab