iOS: More FileName::appendPath -> pathAppended changes

Change-Id: I3db6b1778e6e47e26e243fb2609c481651aa91fe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-05-15 15:49:19 +02:00
parent c874f07d53
commit 166cb39709
8 changed files with 21 additions and 28 deletions

View File

@@ -214,7 +214,7 @@ static void setupKit(Kit *kit, Core::Id pDeviceType, const ToolChainPair& toolCh
static QVersionNumber findXcodeVersion(const Utils::FileName &developerPath) static QVersionNumber findXcodeVersion(const Utils::FileName &developerPath)
{ {
FileName xcodeInfo = developerPath.parentDir().appendPath("Info.plist"); const FileName xcodeInfo = developerPath.parentDir().pathAppended("Info.plist");
if (xcodeInfo.exists()) { if (xcodeInfo.exists()) {
QSettings settings(xcodeInfo.toString(), QSettings::NativeFormat); QSettings settings(xcodeInfo.toString(), QSettings::NativeFormat);
return QVersionNumber::fromString(settings.value("CFBundleShortVersionString").toString()); return QVersionNumber::fromString(settings.value("CFBundleShortVersionString").toString());

View File

@@ -50,6 +50,7 @@
#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state) #define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state)
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils;
namespace Ios { namespace Ios {
namespace Internal { namespace Internal {
@@ -86,7 +87,7 @@ bool IosDeployStep::init()
auto runConfig = qobject_cast<const IosRunConfiguration *>( auto runConfig = qobject_cast<const IosRunConfiguration *>(
this->target()->activeRunConfiguration()); this->target()->activeRunConfiguration());
QTC_ASSERT(runConfig, return false); QTC_ASSERT(runConfig, return false);
m_bundlePath = runConfig->bundleDirectory().toString(); m_bundlePath = runConfig->bundleDirectory();
if (iosdevice()) { if (iosdevice()) {
m_deviceType = IosDeviceType(IosDeviceType::IosDevice, deviceId()); m_deviceType = IosDeviceType(IosDeviceType::IosDevice, deviceId());
@@ -122,7 +123,7 @@ void IosDeployStep::doRun()
connect(m_toolHandler, &IosToolHandler::errorMsg, connect(m_toolHandler, &IosToolHandler::errorMsg,
this, &IosDeployStep::handleErrorMsg); this, &IosDeployStep::handleErrorMsg);
checkProvisioningProfile(); checkProvisioningProfile();
m_toolHandler->requestTransferApp(appBundle(), m_deviceType.identifier); m_toolHandler->requestTransferApp(m_bundlePath.toString(), m_deviceType.identifier);
} }
void IosDeployStep::doCancel() void IosDeployStep::doCancel()
@@ -227,11 +228,6 @@ QString IosDeployStep::deviceId() const
return iosdevice()->uniqueDeviceID(); return iosdevice()->uniqueDeviceID();
} }
QString IosDeployStep::appBundle() const
{
return m_bundlePath;
}
void IosDeployStep::raiseError(const QString &errorString) void IosDeployStep::raiseError(const QString &errorString)
{ {
emit addTask(Task(Task::Error, errorString, Utils::FileName::fromString(QString()), -1, emit addTask(Task(Task::Error, errorString, Utils::FileName::fromString(QString()), -1,
@@ -249,8 +245,7 @@ void IosDeployStep::checkProvisioningProfile()
if (device.isNull()) if (device.isNull())
return; return;
Utils::FileName provisioningFilePath = Utils::FileName::fromString(appBundle()); const FileName provisioningFilePath = m_bundlePath.pathAppended("embedded.mobileprovision");
provisioningFilePath.appendPath(QLatin1String("embedded.mobileprovision"));
// the file is a signed plist stored in DER format // the file is a signed plist stored in DER format
// we simply search for start and end of the plist instead of decoding the DER payload // we simply search for start and end of the plist instead of decoding the DER payload

View File

@@ -76,7 +76,6 @@ private:
IosSimulator::ConstPtr iossimulator() const; IosSimulator::ConstPtr iossimulator() const;
QString deviceId() const; QString deviceId() const;
QString appBundle() const;
void raiseError(const QString &error); void raiseError(const QString &error);
void writeOutput(const QString &text, OutputFormat = OutputFormat::NormalMessage); void writeOutput(const QString &text, OutputFormat = OutputFormat::NormalMessage);
void checkProvisioningProfile(); void checkProvisioningProfile();
@@ -84,7 +83,7 @@ private:
TransferStatus m_transferStatus = NoTransfer; TransferStatus m_transferStatus = NoTransfer;
IosToolHandler *m_toolHandler = nullptr; IosToolHandler *m_toolHandler = nullptr;
ProjectExplorer::IDevice::ConstPtr m_device; ProjectExplorer::IDevice::ConstPtr m_device;
QString m_bundlePath; Utils::FileName m_bundlePath;
IosDeviceType m_deviceType; IosDeviceType m_deviceType;
static const Core::Id Id; static const Core::Id Id;
bool m_expectFail = false; bool m_expectFail = false;

View File

@@ -146,8 +146,8 @@ QStringList IosDsymBuildStep::defaultCleanCmdList() const
QStringList IosDsymBuildStep::defaultCmdList() const QStringList IosDsymBuildStep::defaultCmdList() const
{ {
QString dsymutilCmd = "dsymutil"; QString dsymutilCmd = "dsymutil";
Utils::FileName dsymUtilPath = IosConfigurations::developerPath() const Utils::FileName dsymUtilPath = IosConfigurations::developerPath()
.appendPath("Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil"); .pathAppended("Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil");
if (dsymUtilPath.exists()) if (dsymUtilPath.exists())
dsymutilCmd = dsymUtilPath.toUserOutput(); dsymutilCmd = dsymUtilPath.toUserOutput();
auto runConf = qobject_cast<const IosRunConfiguration *>(target()->activeRunConfiguration()); auto runConf = qobject_cast<const IosRunConfiguration *>(target()->activeRunConfiguration());

View File

@@ -165,13 +165,13 @@ QString IosRunConfiguration::applicationName() const
FileName IosRunConfiguration::bundleDirectory() const FileName IosRunConfiguration::bundleDirectory() const
{ {
FileName res;
Core::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit()); Core::Id devType = DeviceTypeKitAspect::deviceTypeId(target()->kit());
bool isDevice = (devType == Constants::IOS_DEVICE_TYPE); bool isDevice = (devType == Constants::IOS_DEVICE_TYPE);
if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) { if (!isDevice && devType != Constants::IOS_SIMULATOR_TYPE) {
qCWarning(iosLog) << "unexpected device type in bundleDirForTarget: " << devType.toString(); qCWarning(iosLog) << "unexpected device type in bundleDirForTarget: " << devType.toString();
return res; return {};
} }
FileName res;
if (BuildConfiguration *bc = target()->activeBuildConfiguration()) { if (BuildConfiguration *bc = target()->activeBuildConfiguration()) {
Project *project = target()->project(); Project *project = target()->project();
if (ProjectNode *node = project->findNodeForBuildKey(buildKey())) if (ProjectNode *node = project->findNodeForBuildKey(buildKey()))
@@ -182,29 +182,28 @@ FileName IosRunConfiguration::bundleDirectory() const
case BuildConfiguration::Debug : case BuildConfiguration::Debug :
case BuildConfiguration::Unknown : case BuildConfiguration::Unknown :
if (isDevice) if (isDevice)
res.appendPath(QLatin1String("Debug-iphoneos")); res = res.pathAppended("Debug-iphoneos");
else else
res.appendPath(QLatin1String("Debug-iphonesimulator")); res = res.pathAppended("Debug-iphonesimulator");
break; break;
case BuildConfiguration::Profile : case BuildConfiguration::Profile :
case BuildConfiguration::Release : case BuildConfiguration::Release :
if (isDevice) if (isDevice)
res.appendPath(QLatin1String("Release-iphoneos")); res = res.pathAppended("Release-iphoneos");
else else
res.appendPath(QLatin1String("Release-iphonesimulator")); res = res.pathAppended("Release-iphonesimulator");
break; break;
default: default:
qCWarning(iosLog) << "IosBuildStep had an unknown buildType " qCWarning(iosLog) << "IosBuildStep had an unknown buildType "
<< target()->activeBuildConfiguration()->buildType(); << target()->activeBuildConfiguration()->buildType();
} }
} }
res.appendPath(applicationName() + QLatin1String(".app")); return res.pathAppended(applicationName() + ".app");
return res;
} }
FileName IosRunConfiguration::localExecutable() const FileName IosRunConfiguration::localExecutable() const
{ {
return bundleDirectory().appendPath(applicationName()); return bundleDirectory().pathAppended(applicationName());
} }
void IosDeviceTypeAspect::fromMap(const QVariantMap &map) void IosDeviceTypeAspect::fromMap(const QVariantMap &map)

View File

@@ -449,9 +449,9 @@ void IosDebugSupport::start()
if (deviceSdk1.toFileInfo().isDir()) { if (deviceSdk1.toFileInfo().isDir()) {
deviceSdk = deviceSdk1.toString(); deviceSdk = deviceSdk1.toString();
} else { } else {
FileName deviceSdk2 = IosConfigurations::developerPath() const FileName deviceSdk2 = IosConfigurations::developerPath()
.appendPath("Platforms/iPhoneOS.platform/DeviceSupport/") .pathAppended("Platforms/iPhoneOS.platform/DeviceSupport/"
.appendPath(osVersion).appendPath("Symbols"); + osVersion + "/Symbols");
if (deviceSdk2.toFileInfo().isDir()) { if (deviceSdk2.toFileInfo().isDir()) {
deviceSdk = deviceSdk2.toString(); deviceSdk = deviceSdk2.toString();
} else { } else {

View File

@@ -275,7 +275,7 @@ void IosSettingsWidget::onScreenshot()
const auto generatePath = [this](const SimulatorInfo &info) { const auto generatePath = [this](const SimulatorInfo &info) {
const QString fileName = QString("%1_%2_%3.png").arg(info.name).arg(info.runtimeName) const QString fileName = QString("%1_%2_%3.png").arg(info.name).arg(info.runtimeName)
.arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss-z")).replace(' ', '_'); .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss-z")).replace(' ', '_');
return m_ui->pathWidget->fileName().appendPath(fileName).toString(); return m_ui->pathWidget->fileName().pathAppended(fileName).toString();
}; };
QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this); QPointer<SimulatorOperationDialog> statusDialog = new SimulatorOperationDialog(this);

View File

@@ -96,7 +96,7 @@ static bool runSimCtlCommand(QStringList args, QString *output)
static bool launchSimulator(const QString &simUdid) { static bool launchSimulator(const QString &simUdid) {
QTC_ASSERT(!simUdid.isEmpty(), return false); QTC_ASSERT(!simUdid.isEmpty(), return false);
const QString simulatorAppPath = IosConfigurations::developerPath() const QString simulatorAppPath = IosConfigurations::developerPath()
.appendPath("Applications/Simulator.app/Contents/MacOS/Simulator").toString(); .pathAppended("Applications/Simulator.app/Contents/MacOS/Simulator").toString();
if (IosConfigurations::xcodeVersion() >= QVersionNumber(9)) { if (IosConfigurations::xcodeVersion() >= QVersionNumber(9)) {
// For XCode 9 boot the second device instead of launching simulator app twice. // For XCode 9 boot the second device instead of launching simulator app twice.