forked from qt-creator/qt-creator
Using target name instead of ID in shadow build dir
Task-number: QTCREATORBUG-7901 Change-Id: Ia38ea896809e7793439e412e260b7cdc409923da Reviewed-by: Daniel Teske <daniel.teske@digia.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -53,6 +53,22 @@ const char ICON_KEY[] = "PE.Profile.Icon";
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Helper:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
static QString cleanName(const QString &name)
|
||||
{
|
||||
QString result = name;
|
||||
result.replace(QRegExp("\\W"), QLatin1String("_"));
|
||||
result.replace(QRegExp("_+"), "_"); // compact _
|
||||
result.remove(QRegExp("^_*")); // remove leading _
|
||||
result.remove(QRegExp("_+$")); // remove trailing _
|
||||
if (result.isEmpty())
|
||||
result = QLatin1String("unknown");
|
||||
return result;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// KitPrivate
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -185,6 +201,22 @@ void Kit::setDisplayName(const QString &name)
|
||||
kitUpdated();
|
||||
}
|
||||
|
||||
QString Kit::fileSystemFriendlyName() const
|
||||
{
|
||||
QString name = cleanName(displayName());
|
||||
foreach (Kit *i, KitManager::instance()->kits()) {
|
||||
if (i == this)
|
||||
continue;
|
||||
if (name == cleanName(i->displayName())) {
|
||||
// append part of the kit id: That should be unique enough;-)
|
||||
// Leading { will be turned into _ which should be fine.
|
||||
name = cleanName(name + QLatin1Char('_') + (id().toString().left(7)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
bool Kit::isAutoDetected() const
|
||||
{
|
||||
return d->m_autodetected;
|
||||
|
||||
@@ -64,6 +64,8 @@ public:
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &name);
|
||||
|
||||
QString fileSystemFriendlyName() const;
|
||||
|
||||
bool isAutoDetected() const;
|
||||
Core::Id id() const;
|
||||
|
||||
|
||||
@@ -1412,7 +1412,8 @@ QString Qt4Project::buildNameFor(const Kit *k)
|
||||
{
|
||||
if (!k)
|
||||
return QLatin1String("unknown");
|
||||
return QString::fromLatin1(k->id().name()).mid(31, 6); // part of the UUID, should be pretty unique;-)
|
||||
|
||||
return k->fileSystemFriendlyName();
|
||||
}
|
||||
|
||||
Target *Qt4Project::createTarget(Kit *k, const QList<BuildConfigurationInfo> &infoList)
|
||||
|
||||
Reference in New Issue
Block a user