forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user