diff options
author | Jake Petroules <jake.petroules@petroules.com> | 2014-08-20 19:36:18 -0400 |
---|---|---|
committer | Jake Petroules <jake.petroules@petroules.com> | 2014-11-04 03:47:37 +0100 |
commit | deeded829e6b0f94b1f5ba90e299dd759d33e762 (patch) | |
tree | a5e3563eaa0a87468a16290282a9fa156dd62ea7 /tests/auto/shared.h | |
parent | fba7c960a4b5965b0e58969cbed49d1171347c4c (diff) |
Consolidate "safe identifier" code by introducing qbs.rfc1034identifier.
Instead of duplicating this logic in three places across two languages,
it's now implemented in a central location in C++ and exposed to
JavaScript. As an intentional side effect, build directory naming now
uses - instead of _ as per the RFC 1034 name charset.
Change-Id: I1a7c3ec45efc5b29f9a05067e4c2cf640af4a7aa
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tests/auto/shared.h')
-rw-r--r-- | tests/auto/shared.h | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/tests/auto/shared.h b/tests/auto/shared.h index ea45f727e..67ea19128 100644 --- a/tests/auto/shared.h +++ b/tests/auto/shared.h @@ -64,14 +64,7 @@ inline QString relativeProductBuildDir(const QString &productName, const QString &profileName = QString()) { const QString fullName = uniqueProductName(productName, profileName); - QString dirName = fullName; - for (int i = 0; i < dirName.count(); ++i) { - QCharRef c = dirName[i]; - const bool okChar = (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') - || (c >= 'a' && c <= 'z') || c == '_' || c == '.'; - if (!okChar) - c = QChar::fromLatin1('_'); - } + QString dirName = qbs::Internal::HostOsInfo::rfc1034Identifier(fullName); const QByteArray hash = QCryptographicHash::hash(fullName.toUtf8(), QCryptographicHash::Sha1); dirName.append('.').append(hash.toHex().left(8)); return relativeBuildDir() + '/' + dirName; |