Android: Fix AndroidManifest wizard invalid package source dir

Fix the wizard from inserting the filename for the file path leading to
an invalid directory.

Example invalid path: /projectpath/projectname/projectname.pro/android
With fixed path: /projectpath/projectname/android

Fixes: QTCREATORBUG-26580
Change-Id: If82a6f795ca400beddc26b959e65ea066ad79433
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Jonathan Mouchou
2021-11-14 17:25:44 -08:00
parent 949f7c3e84
commit 6efcd09063
2 changed files with 5 additions and 2 deletions

View File

@@ -227,7 +227,10 @@ void ChooseDirectoryPage::initializePage()
"The files in the Android package source directory are copied to the build directory's " "The files in the Android package source directory are copied to the build directory's "
"Android directory and the default files are overwritten.")); "Android directory and the default files are overwritten."));
m_androidPackageSourceDir->setFilePath(bti.projectFilePath / "android"); const FilePath projectPath = bti.projectFilePath.isFile()
? bti.projectFilePath.parentDir() : bti.projectFilePath;
m_androidPackageSourceDir->setFilePath(projectPath / "android");
connect(m_androidPackageSourceDir, &PathChooser::rawPathChanged, connect(m_androidPackageSourceDir, &PathChooser::rawPathChanged,
this, &ChooseDirectoryPage::checkPackageSourceDir); this, &ChooseDirectoryPage::checkPackageSourceDir);
} else { } else {

View File

@@ -1014,7 +1014,7 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
BuildTargetInfo bti; BuildTargetInfo bti;
bti.displayName = ct.title; bti.displayName = ct.title;
bti.targetFilePath = ct.executable; bti.targetFilePath = ct.executable;
bti.projectFilePath = ct.sourceDirectory.stringAppended("/"); bti.projectFilePath = ct.sourceDirectory.cleanPath();
bti.workingDirectory = ct.workingDirectory; bti.workingDirectory = ct.workingDirectory;
bti.buildKey = buildKey; bti.buildKey = buildKey;
bti.usesTerminal = !ct.linksToQtGui; bti.usesTerminal = !ct.linksToQtGui;