diff options
author | Yoann Lopes <yoann.lopes@digia.com> | 2013-06-03 19:58:30 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@digia.com> | 2013-06-04 13:11:45 +0200 |
commit | bab3b010af548b2fdd401dc90e17d30cfe2abceb (patch) | |
tree | 3474fb640fb862aa6182fb7a76a0685d68efa4d5 | |
parent | b0854e3c71803c8397f9bb48b8766c151b6e0edd (diff) | |
download | qt-creator-bab3b010af548b2fdd401dc90e17d30cfe2abceb.tar.gz |
Android: fixed updating Java files on Windows.
When looking for lines in Java files that are not supported by the
selected API level, it didn't take into account that line endings are
"\r\n" on Windows. toInt() was failing, trying to convert for example
"10\r" to an integer.
Change-Id: I35478abd40d5ce4621d2320b3a5f5a3514cf9591
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
-rw-r--r-- | src/plugins/android/androidmanager.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 03aa1b56b6..ed2fb8d10f 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -633,19 +633,20 @@ void AndroidManager::updateTarget(ProjectExplorer::Target *target, const QString bool modified = false; bool comment = false; for (int i = 0; i < lines.size(); i++) { - if (lines[i].contains("@ANDROID-")) { - commentLines = targetSDKNumber < lines[i].mid(lines[i].lastIndexOf('-') + 1).toInt(); + QByteArray trimmed = lines[i].trimmed(); + if (trimmed.contains("@ANDROID-")) { + commentLines = targetSDKNumber < trimmed.mid(trimmed.lastIndexOf('-') + 1).toInt(); comment = !comment; continue; } if (!comment) continue; if (commentLines) { - if (!lines[i].trimmed().startsWith("//QtCreator")) { + if (!trimmed.startsWith("//QtCreator")) { lines[i] = "//QtCreator " + lines[i]; modified = true; } - } else { if (lines[i].trimmed().startsWith("//QtCreator")) { + } else { if (trimmed.startsWith("//QtCreator")) { lines[i] = lines[i].mid(12); modified = true; } |