| 96 | } |
| 97 | |
| 98 | void updateFileHandler::parseOneLine(QString &line, bool checkExistence) |
| 99 | { |
| 100 | QStringList lineSplit = line.split(" "); |
| 101 | if (line.startsWith("Last Commit")) |
| 102 | { |
| 103 | if (line.startsWith("Last Commit: ")) |
| 104 | DEBUG_UPDATE_FILE("updateFileHandler::parseOneLine Local file last commit: " << lineSplit[2]); |
| 105 | return; |
| 106 | } |
| 107 | // Ignore all lines that start with %, / or # |
| 108 | if (line.startsWith("%") || line.startsWith("/") || line.startsWith("#")) |
| 109 | return; |
| 110 | if (lineSplit.count() == 4) |
| 111 | { |
| 112 | auto entry = createFileEntry(lineSplit); |
| 113 | |
| 114 | if (checkExistence) |
| 115 | { |
| 116 | // Check if the file exists locally |
| 117 | QFileInfo fInfo(this->updatePath + entry.filePath); |
| 118 | if (fInfo.exists() && fInfo.isFile()) |
| 119 | this->updateFileList.append(entry); |
| 120 | else |
| 121 | // The file does not exist locally. That is strange since it is in the update info file. |
| 122 | // Files that do not exist locally should always be downloaded so we don't put them into the list. |
| 123 | DEBUG_UPDATE_FILE("updateFileHandler::parseOneLine The local file " << fInfo.absoluteFilePath() << " could not be found."); |
| 124 | } |
| 125 | else |
| 126 | // Do not check if the file exists |
| 127 | this->updateFileList.append(entry); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | QList<downloadFile> updateFileHandler::getFilesToUpdate(updateFileHandler &localFiles) const |
| 132 | { |
no test coverage detected