ProjectExplorer: remove confusing function from Project

Change-Id: Ifaed5d8293dadd2ae3cfdab3b027434d4f8caa3e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2024-05-02 14:39:12 +02:00
parent b7dff8b636
commit bf41545468
8 changed files with 14 additions and 27 deletions

View File

@@ -1593,9 +1593,8 @@ FilePath CMakeBuildConfiguration::shadowBuildDirectory(const FilePath &projectFi
return {}; return {};
const QString projectName = projectFilePath.parentDir().fileName(); const QString projectName = projectFilePath.parentDir().fileName();
const FilePath projectDir = Project::projectDirectory(projectFilePath); FilePath buildPath = buildDirectoryFromTemplate(
FilePath buildPath = buildDirectoryFromTemplate(projectDir, projectFilePath, projectName, k, projectFilePath.absolutePath(), projectFilePath, projectName, k, bcName, buildType, "cmake");
bcName, buildType, "cmake");
if (CMakeGeneratorKitAspect::isMultiConfigGenerator(k)) { if (CMakeGeneratorKitAspect::isMultiConfigGenerator(k)) {
const QString path = buildPath.path(); const QString path = buildPath.path();
@@ -1906,8 +1905,6 @@ CMakeBuildConfigurationFactory::CMakeBuildConfigurationFactory()
setBuildGenerator([](const Kit *k, const FilePath &projectPath, bool forSetup) { setBuildGenerator([](const Kit *k, const FilePath &projectPath, bool forSetup) {
QList<BuildInfo> result; QList<BuildInfo> result;
FilePath path = forSetup ? Project::projectDirectory(projectPath) : projectPath;
// Skip the default shadow build directories for build types if we have presets // Skip the default shadow build directories for build types if we have presets
const CMakeConfigItem presetItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(k); const CMakeConfigItem presetItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(k);
if (!presetItem.isNull()) if (!presetItem.isNull())

View File

@@ -62,7 +62,7 @@ public:
setBuildGenerator([](const Kit *, const FilePath &projectPath, bool forSetup) { setBuildGenerator([](const Kit *, const FilePath &projectPath, bool forSetup) {
BuildInfo info; BuildInfo info;
info.typeName = ProjectExplorer::Tr::tr("Build"); info.typeName = ProjectExplorer::Tr::tr("Build");
info.buildDirectory = forSetup ? Project::projectDirectory(projectPath) : projectPath; info.buildDirectory = forSetup ? projectPath.absolutePath() : projectPath;
if (forSetup) { if (forSetup) {
//: The name of the build configuration created by default for a generic project. //: The name of the build configuration created by default for a generic project.

View File

@@ -64,7 +64,7 @@ static FilePath shadowBuildDirectory(const FilePath &projectFilePath,
const QString projectName = projectFilePath.parentDir().fileName(); const QString projectName = projectFilePath.parentDir().fileName();
return MesonBuildConfiguration::buildDirectoryFromTemplate( return MesonBuildConfiguration::buildDirectoryFromTemplate(
Project::projectDirectory(projectFilePath), projectFilePath, projectFilePath.absolutePath(), projectFilePath,
projectName, k, bcName, buildType, "meson"); projectName, k, bcName, buildType, "meson");
} }

View File

@@ -793,20 +793,7 @@ void Project::toMap(Store &map) const
FilePath Project::projectDirectory() const FilePath Project::projectDirectory() const
{ {
return projectDirectory(projectFilePath()); return projectFilePath().absolutePath();
}
/*!
Returns the directory that contains the file \a top.
This includes the absolute path.
*/
FilePath Project::projectDirectory(const FilePath &top)
{
if (top.isEmpty())
return {};
return top.absolutePath();
} }
void Project::changeRootProjectDirectory() void Project::changeRootProjectDirectory()

View File

@@ -70,7 +70,6 @@ public:
Utils::FilePath projectFilePath() const; Utils::FilePath projectFilePath() const;
Utils::FilePath projectDirectory() const; Utils::FilePath projectDirectory() const;
static Utils::FilePath projectDirectory(const Utils::FilePath &top);
// This does not affect nodes, only the root path. // This does not affect nodes, only the root path.
void changeRootProjectDirectory(); void changeRootProjectDirectory();

View File

@@ -44,8 +44,7 @@ static FilePath defaultBuildDirectory(const FilePath &projectFilePath, const Kit
{ {
const QString projectName = projectFilePath.completeBaseName(); const QString projectName = projectFilePath.completeBaseName();
return BuildConfiguration::buildDirectoryFromTemplate( return BuildConfiguration::buildDirectoryFromTemplate(
Project::projectDirectory(projectFilePath), projectFilePath.absolutePath(), projectFilePath, projectName, k, bcName, buildType, "qbs");
projectFilePath, projectName, k, bcName, buildType, "qbs");
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -74,8 +74,13 @@ static FilePath buildDir(const FilePath &projectFilePath, const Kit *k)
{ {
const QString projectName = projectFilePath.completeBaseName(); const QString projectName = projectFilePath.completeBaseName();
return BuildConfiguration::buildDirectoryFromTemplate( return BuildConfiguration::buildDirectoryFromTemplate(
Project::projectDirectory(projectFilePath), projectFilePath.absolutePath(),
projectFilePath, projectName, k, QString(), BuildConfiguration::Unknown, "qbs"); projectFilePath,
projectName,
k,
QString(),
BuildConfiguration::Unknown,
"qbs");
} }
static bool hasBuildGraph(const FilePath &dir) static bool hasBuildGraph(const FilePath &dir)

View File

@@ -73,7 +73,7 @@ FilePath QmakeBuildConfiguration::shadowBuildDirectory(const FilePath &proFilePa
return {}; return {};
const QString projectName = proFilePath.completeBaseName(); const QString projectName = proFilePath.completeBaseName();
return buildDirectoryFromTemplate(Project::projectDirectory(proFilePath), proFilePath, return buildDirectoryFromTemplate(proFilePath.absolutePath(), proFilePath,
projectName, k, suffix, buildType, "qmake"); projectName, k, suffix, buildType, "qmake");
} }