Commit bab3b010 authored by Yoann Lopes's avatar Yoann Lopes
Browse files

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: default avatarDaniel Teske <daniel.teske@digia.com>
parent b0854e3c
......@@ -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;
}
......
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