diff options
| author | Thomas Tanner <trtanner@btinternet.com> | 2015-10-11 21:12:37 +0100 |
|---|---|---|
| committer | Thomas Tanner <trtanner@btinternet.com> | 2015-10-11 21:12:37 +0100 |
| commit | 9a7b0ee2c78f1807d34e754d1f051c88b55a2f0c (patch) | |
| tree | 38d8f0040b3b0faa5021b253ede5e8345d045ded /src/nexusinterface.cpp | |
| parent | c5876cb6a142dc228ff3e3c3a936699f58d6b2a0 (diff) | |
Fixes for quotes in module names:
Treat the module name from Nexus as HTML and convert into plain text.
Allow ' in a module name
Also removed the ::tr1:: namespace in the regexs
Diffstat (limited to 'src/nexusinterface.cpp')
| -rw-r--r-- | src/nexusinterface.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index dc027be4..25f3d1b4 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -196,12 +196,13 @@ void NexusInterface::loginCompleted() void NexusInterface::interpretNexusFileName(const QString &fileName, QString &modName, int &modID, bool query)
{
- static std::tr1::regex exp("^([a-zA-Z0-9_\\- ]*?)([-_ ][VvRr]?[0-9_]+)?-([1-9][0-9]+).*");
- static std::tr1::regex simpleexp("^([a-zA-Z0-9_]+)");
+ //Look for something along the lines of modulename-Vn-m + any old rubbish.
+ static std::regex exp("^([a-zA-Z0-9_'\"\\- ]*?)([-_ ][VvRr]?[0-9_]+)?-([1-9][0-9]+).*");
+ static std::regex simpleexp("^([a-zA-Z0-9_]+)");
QByteArray fileNameUTF8 = fileName.toUtf8();
- std::tr1::cmatch result;
- if (std::tr1::regex_search(fileNameUTF8.constData(), result, exp)) {
+ std::cmatch result;
+ if (std::regex_search(fileNameUTF8.constData(), result, exp)) {
modName = QString::fromUtf8(result[1].str().c_str());
modName = modName.replace('_', ' ').trimmed();
@@ -231,7 +232,7 @@ void NexusInterface::interpretNexusFileName(const QString &fileName, QString &mo modID = strtol(candidate.c_str(), nullptr, 10);
}
qDebug("mod id guessed: %s -> %d", qPrintable(fileName), modID);
- } else if (std::tr1::regex_search(fileNameUTF8.constData(), result, simpleexp)) {
+ } else if (std::regex_search(fileNameUTF8.constData(), result, simpleexp)) {
qDebug("simple expression matched, using name only");
modName = QString::fromUtf8(result[1].str().c_str());
modName = modName.replace('_', ' ').trimmed();
|
