Commit 6a58e1b9 authored by Tobias Hunger's avatar Tobias Hunger

Using target name instead of ID in shadow build dir

Task-number: QTCREATORBUG-7901
Change-Id: Ia38ea896809e7793439e412e260b7cdc409923da
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent a630a268
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment