From 2cf6cd6cba5bf7d4062991ac009546bc5cc8135d Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@nokia.com>
Date: Mon, 2 Jan 2012 15:54:51 +0100
Subject: [PATCH] QmlProject: Print a warning if the mainFile given is not
 readable

Change-Id: If5951bb3121b13287a3ccf9d684bf23e0673231c
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
---
 src/plugins/qmlprojectmanager/qmlproject.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp
index 508277950de..0e4a8be5d2d 100644
--- a/src/plugins/qmlprojectmanager/qmlproject.cpp
+++ b/src/plugins/qmlprojectmanager/qmlproject.cpp
@@ -122,6 +122,17 @@ void QmlProject::parseProject(RefreshOptions options)
         if (m_projectItem) {
             m_projectItem.data()->setSourceDirectory(projectDir().path());
             m_modelManager->updateSourceFiles(m_projectItem.data()->files(), true);
+
+            QString mainFilePath = m_projectItem.data()->mainFile();
+            if (!mainFilePath.isEmpty()) {
+                mainFilePath = projectDir().absoluteFilePath(mainFilePath);
+                if (!QFileInfo(mainFilePath).isReadable()) {
+                    messageManager->printToOutputPane(
+                                tr("Warning while loading project file %1.").arg(m_fileName));
+                    messageManager->printToOutputPane(
+                                tr("File '%' does not exist or is not readable.").arg(mainFilePath), true);
+                }
+            }
         }
         m_rootNode->refresh();
     }
-- 
GitLab