MCPcopy Create free account
hub / github.com/PrismLauncher/PrismLauncher / read_lock_File

Function read_lock_File

launcher/Application.cpp:263–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261} // namespace
262
263std::tuple<QDateTime, QString, QString, QString, QString> read_lock_File(const QString& path)
264{
265 auto contents = QString(FS::read(path));
266 auto lines = contents.split('\n');
267
268 QDateTime timestamp;
269 QString from, to, target, data_path;
270 for (auto line : lines) {
271 auto index = line.indexOf("=");
272 if (index < 0)
273 continue;
274 auto left = line.left(index);
275 auto right = line.mid(index + 1);
276 if (left.toLower() == "timestamp") {
277 timestamp = QDateTime::fromString(right, Qt::ISODate);
278 } else if (left.toLower() == "from") {
279 from = right;
280 } else if (left.toLower() == "to") {
281 to = right;
282 } else if (left.toLower() == "target") {
283 target = right;
284 } else if (left.toLower() == "data_path") {
285 data_path = right;
286 }
287 }
288 return std::make_tuple(timestamp, from, to, target, data_path);
289}
290
291Application::Application(int& argc, char** argv) : QApplication(argc, argv)
292{

Callers 1

ApplicationMethod · 0.70

Calls 2

readFunction · 0.85
QStringClass · 0.70

Tested by

no test coverage detected