forked from qt-creator/qt-creator
QmlDesigner: Adjust paths for new project structure
Before we used "content" but in the new project structure we will use "ProjectNameContent" to make the uri unique. First check for "content" to support older project. Keeping only the implementation in DocumentManager::currentResourcePath() Change-Id: Ib6b21f52c078fdb9a2ff31c02855754f83741538 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -1138,10 +1138,7 @@ static QString getAssetDefaultDirectory(const QString &assetDir, const QString &
|
|||||||
{
|
{
|
||||||
QString adjustedDefaultDirectory = defaultDirectory;
|
QString adjustedDefaultDirectory = defaultDirectory;
|
||||||
|
|
||||||
Utils::FilePath contentPath = QmlDesignerPlugin::instance()->documentManager().currentProjectDirPath();
|
Utils::FilePath contentPath = QmlDesignerPlugin::instance()->documentManager().currentResourcePath();
|
||||||
|
|
||||||
if (contentPath.pathAppended("content").exists())
|
|
||||||
contentPath = contentPath.pathAppended("content");
|
|
||||||
|
|
||||||
Utils::FilePath assetPath = contentPath.pathAppended(assetDir);
|
Utils::FilePath assetPath = contentPath.pathAppended(assetDir);
|
||||||
|
|
||||||
|
@@ -544,6 +544,13 @@ Utils::FilePath DocumentManager::currentResourcePath()
|
|||||||
if (contentFilePath.exists())
|
if (contentFilePath.exists())
|
||||||
return contentFilePath;
|
return contentFilePath;
|
||||||
|
|
||||||
|
const auto project = ProjectManager::startupProject();
|
||||||
|
const QString baseName = project->rootProjectDirectory().baseName() + "Content";
|
||||||
|
|
||||||
|
contentFilePath = resourcePath.pathAppended(baseName);
|
||||||
|
if (contentFilePath.exists())
|
||||||
|
return contentFilePath;
|
||||||
|
|
||||||
return resourcePath;
|
return resourcePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user