| 47 | return default_val; |
| 48 | } |
| 49 | void AppVersionManifest::buildFromFileSystem(const QString &basePath) |
| 50 | { |
| 51 | // + - included in project manifest |
| 52 | // - - not included in manifest. |
| 53 | // schema is : |
| 54 | // + project_dir/project.manifest - must contain at least Channel data for selected_channel |
| 55 | // - project_dir/selected_channel - if missing 'release' is assumed |
| 56 | // + project_dir/version - if missing '0.0.0' is assumed |
| 57 | // - project_dir/*_backup - backup for given project channel, |
| 58 | // - project_dir/install_temp - most recently downloaded update/channel change data |
| 59 | // + project_dir/** project data |
| 60 | QDir baseDir(basePath); |
| 61 | m_version=ifExistsGetContents(baseDir.filePath("version"),"0.0.0"); |
| 62 | m_files.clear(); |
| 63 | |
| 64 | QStringList files; |
| 65 | QDirIterator it(basePath, QDir::Files,QDirIterator::Subdirectories); |
| 66 | while(it.hasNext()) { |
| 67 | QString fpath = it.next(); |
| 68 | // add paths relative to basePath |
| 69 | files << fpath.mid(basePath.size()+1); |
| 70 | } |
| 71 | QRegExp backupRegex(".*_backup"); |
| 72 | for(auto iter=files.begin(); iter!=files.end(); ) { |
| 73 | if(iter->contains(backupRegex)) |
| 74 | iter = files.erase(iter); |
| 75 | else |
| 76 | ++iter; |
| 77 | } |
| 78 | files.removeAll("selected_channel"); |
| 79 | files.removeAll("install_temp"); |
| 80 | for(const QString &flp : files) { |
| 81 | m_files.emplace(FileDescription {flp,""}); |
| 82 | } |
| 83 | } |
| 84 | bool AppVersionManifest::operator==(const AppVersionManifest & other) const |
| 85 | { |
| 86 | if(m_version!=other.m_version) |