forked from qt-creator/qt-creator
QmlDesigner: Fix DocumentManager::currentFilePath
If no QML file was opened this was not working
since we returned too early. This fixes the
function in case no QML file was opened.
Change-Id: Ie6b8b4becfee4ed05760e31b766d8d0a9b88a666
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
(cherry picked from commit 77455efafa
)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
committed by
Thomas Hartmann
parent
3a39a5e50e
commit
aa80940076
@@ -351,12 +351,16 @@ Utils::FilePath DocumentManager::currentProjectDirPath()
|
||||
{
|
||||
QTC_ASSERT(QmlDesignerPlugin::instance(), return {});
|
||||
|
||||
if (!QmlDesignerPlugin::instance()->currentDesignDocument())
|
||||
if (!QmlDesignerPlugin::instance()->currentDesignDocument()) {
|
||||
if (ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::startupProject())
|
||||
return project->projectDirectory();
|
||||
return {};
|
||||
}
|
||||
|
||||
Utils::FilePath qmlFileName = QmlDesignerPlugin::instance()->currentDesignDocument()->fileName();
|
||||
|
||||
ProjectExplorer::Project *project = ProjectExplorer::ProjectManager::projectForFile(qmlFileName);
|
||||
|
||||
if (project)
|
||||
return project->projectDirectory();
|
||||
|
||||
|
Reference in New Issue
Block a user