| 190 | } |
| 191 | |
| 192 | bool Path::Backup() const { |
| 193 | if (this->IsFile()) { |
| 194 | QFile file(this->AbsolutePath().c_str()); |
| 195 | |
| 196 | QDateTime date_time = QDateTime::currentDateTime(); |
| 197 | std::string date = date_time.toString(Qt::ISODate).toStdString(); |
| 198 | std::replace(date.begin(), date.end(), ':', '-'); |
| 199 | |
| 200 | std::string path = this->AbsolutePath(); |
| 201 | std::string extension = path.substr(path.find_last_of(".")); |
| 202 | std::string prefix = path.substr(0, path.find_last_of(".")); |
| 203 | //"vkconfig-" + date_time.toString(Qt::ISODate).toStdString() + ".json"; |
| 204 | |
| 205 | std::string dest = prefix + "-" + date + extension; |
| 206 | |
| 207 | bool result = file.copy(dest.c_str()); |
| 208 | return result; |
| 209 | } else { |
| 210 | return false; |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | bool Path::Remove() const { |
| 215 | if (!this->Exists()) { |
no test coverage detected